]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/50508 ([C++0x] ICE cxx_eval_logical_expression cp/semantics.c:6487)
authorJason Merrill <jason@redhat.com>
Tue, 27 Sep 2011 02:12:42 +0000 (22:12 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 27 Sep 2011 02:12:42 +0000 (22:12 -0400)
PR c++/50508
* semantics.c (cxx_eval_logical_expression): Use tree_int_cst_equal
rather than ==.

From-SVN: r179228

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/constexpr-typedef1.C [new file with mode: 0644]

index 9de69c864720a3480c6344d8a47264d1e6fe4194..0efa0d682e72b438d426ec6ec7bc7d0d880b5639 100644 (file)
@@ -1,3 +1,9 @@
+2011-09-26  Jason Merrill  <jason@redhat.com>
+
+       PR c++/50508
+       * semantics.c (cxx_eval_logical_expression): Use tree_int_cst_equal
+       rather than ==.
+
 2011-09-26  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/45487
index 19ecbee4d8ad416a2261562d57477ec23621a932..89c76d5a12645cca62bd8549b833ff0cf9ec0025 100644 (file)
@@ -6680,9 +6680,9 @@ cxx_eval_logical_expression (const constexpr_call *call, tree t,
                                           allow_non_constant, addr,
                                           non_constant_p);
   VERIFY_CONSTANT (lhs);
-  if (lhs == bailout_value)
+  if (tree_int_cst_equal (lhs, bailout_value))
     return lhs;
-  gcc_assert (lhs == continue_value);
+  gcc_assert (tree_int_cst_equal (lhs, continue_value));
   r = cxx_eval_constant_expression (call, TREE_OPERAND (t, 1),
                                    allow_non_constant, addr, non_constant_p);
   VERIFY_CONSTANT (r);
index ebc9385a111d45f61b9f8f30e8c40f2a22c46bbe..bc362edf21b7db1021c83a84d738a39b69945e36 100644 (file)
@@ -1,3 +1,8 @@
+2011-09-26  Jason Merrill  <jason@redhat.com>
+
+       PR c++/50508
+       * g++.dg/cpp0x/constexpr-typedef1.C: New.
+
 2011-09-26  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/45487
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-typedef1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-typedef1.C
new file mode 100644 (file)
index 0000000..2719e3a
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/50508
+// { dg-options -std=c++0x }
+
+template <class T>
+  struct integral_constant {
+    typedef T value_type;
+    constexpr operator value_type() { return true; }
+  };
+
+static constexpr bool value = integral_constant<bool>()
+                              && true;