Commit 76c7bf65 by Marc Glisse Committed by Marc Glisse

re PR c++/53000 (Conditional operator does not behave as standardized)

2013-07-09  Marc Glisse  <marc.glisse@inria.fr>

	PR c++/53000
gcc/cp/
	* call.c (build_conditional_expr_1): Preserve xvalues.

gcc/testsuite/
	* g++.dg/cpp0x/decltype17.C: Adjust.

From-SVN: r200821
parent b3ebe3d0
2013-07-09 Marc Glisse <marc.glisse@inria.fr>
PR c++/53000
* call.c (build_conditional_expr_1): Preserve xvalues.
2013-07-09 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51786
......
......@@ -4641,10 +4641,11 @@ build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3,
/* [expr.cond]
If the second and third operands are lvalues and have the same
type, the result is of that type and is an lvalue. */
if (real_lvalue_p (arg2)
&& real_lvalue_p (arg3)
If the second and third operands are glvalues of the same value
category and have the same type, the result is of that type and
value category. */
if (((real_lvalue_p (arg2) && real_lvalue_p (arg3))
|| (xvalue_p (arg2) && xvalue_p (arg3)))
&& same_type_p (arg2_type, arg3_type))
{
result_type = arg2_type;
......
2013-07-09 Marc Glisse <marc.glisse@inria.fr>
PR c++/53000
* g++.dg/cpp0x/decltype17.C: Adjust.
2013-07-09 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51786
......
......@@ -24,6 +24,6 @@ int main()
return 1;
if (strcmp (typeid(g).name(), "FRivE") != 0)
return 2;
if (strcmp (typeid(h).name(), "FivE") != 0)
if (strcmp (typeid(h).name(), "FOivE") != 0)
return 3;
}
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