===================================================================
@@ -17,13 +17,13 @@ decltype(true ? lvalueref() : lvalueref(
decltype(true ? rvalueref() : rvalueref()) h()
{}
int main()
{
if (strcmp (typeid(f).name(), "FivE") != 0)
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;
}
===================================================================
@@ -4634,24 +4634,25 @@ build_conditional_expr_1 (location_t loc
&& CLASS_TYPE_P (arg2_type)
&& cp_type_quals (arg2_type) != cp_type_quals (arg3_type))
arg2_type = arg3_type =
cp_build_qualified_type (arg2_type,
cp_type_quals (arg2_type)
| cp_type_quals (arg3_type));
}
/* [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;
arg2 = mark_lvalue_use (arg2);
arg3 = mark_lvalue_use (arg3);
goto valid_operands;
}
/* [expr.cond]