Commit 3a9ad4c1 by Paolo Carlini Committed by Paolo Carlini

re PR c++/84333 (ICE with ternary operator in template function)

/cp
2018-02-13  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/84333
	* call.c (build_conditional_expr_1): Use cp_save_expr instead of
	save_expr for the G++ extension.

/testsuite
2018-02-13  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/84333
	* g++.dg/template/sizeof16.C: New.
	* g++.dg/template/sizeof17.C: Likewise.

From-SVN: r257638
parent a2f5a782
2018-02-13 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/84333
* call.c (build_conditional_expr_1): Use cp_save_expr instead of
save_expr for the G++ extension.
2018-02-13 Jason Merrill <jason@redhat.com> 2018-02-13 Jason Merrill <jason@redhat.com>
PR c++/84080 - ICE with return type deduction and specialization. PR c++/84080 - ICE with return type deduction and specialization.
......
...@@ -4805,7 +4805,7 @@ build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3, ...@@ -4805,7 +4805,7 @@ build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3,
if (lvalue_p (arg1)) if (lvalue_p (arg1))
arg2 = arg1 = cp_stabilize_reference (arg1); arg2 = arg1 = cp_stabilize_reference (arg1);
else else
arg2 = arg1 = save_expr (arg1); arg2 = arg1 = cp_save_expr (arg1);
} }
/* If something has already gone wrong, just pass that fact up the /* If something has already gone wrong, just pass that fact up the
......
2018-02-13 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/84333
* g++.dg/template/sizeof16.C: New.
* g++.dg/template/sizeof17.C: Likewise.
2018-02-13 Janus Weil <janus@gcc.gnu.org> 2018-02-13 Janus Weil <janus@gcc.gnu.org>
PR fortran/84313 PR fortran/84313
......
// PR c++/84333
// { dg-options -Wno-pedantic }
template<typename> int foo()
{
return sizeof(int) > 1 ? : 1;
}
// PR c++/84333
// { dg-options -Wno-pedantic }
template<typename T> int foo()
{
return sizeof(T) > 1 ? : 1;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment