]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/53000 (Conditional operator does not behave as standardized)
authorMarc Glisse <marc.glisse@inria.fr>
Tue, 9 Jul 2013 15:55:49 +0000 (17:55 +0200)
committerMarc Glisse <glisse@gcc.gnu.org>
Tue, 9 Jul 2013 15:55:49 +0000 (15:55 +0000)
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

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/decltype17.C

index 696ef35825fb6f1ad94702191e9982398f942212..6a04e58fcd3b2ebb1c63c56a4f16cda981676f61 100644 (file)
@@ -1,3 +1,8 @@
+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
index 425ef9bcd95d8fc17d1b6d36f23d04e3abf50eed..78899aba1a600e35e8603b70f56a928ef334b70c 100644 (file)
@@ -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;
index e73706aee795fe8a496dc16a9194646ed372aa79..573d78a2726c4808349f744a9bb9792496649520 100644 (file)
@@ -1,3 +1,8 @@
+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
index 3c98105fced1445585804c5c44a6dc1200a8b304..7f36ff01e50023f70bdf946ca22a57a251451229 100644 (file)
@@ -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;
 }