aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2013-07-09 17:55:49 +0200
committerMarc Glisse <glisse@gcc.gnu.org>2013-07-09 15:55:49 +0000
commit76c7bf65e867b9acd70e13da15d07b51855f0cd4 (patch)
treef3540adac81c02d11b3ff83bf0b6e332e01c1195 /gcc
parentb3ebe3d0e004af8b8569ff847bb636b53163fce6 (diff)
downloadgcc-76c7bf65e867b9acd70e13da15d07b51855f0cd4.zip
gcc-76c7bf65e867b9acd70e13da15d07b51855f0cd4.tar.gz
gcc-76c7bf65e867b9acd70e13da15d07b51855f0cd4.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/call.c9
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/decltype17.C2
4 files changed, 16 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 696ef35..6a04e58 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 425ef9b..78899ab 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e73706a..573d78a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype17.C b/gcc/testsuite/g++.dg/cpp0x/decltype17.C
index 3c98105..7f36ff0 100644
--- a/gcc/testsuite/g++.dg/cpp0x/decltype17.C
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype17.C
@@ -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;
}