From 15442c9c4fc7bb169629a75c170d801e9fa07fd7 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 26 Sep 2011 22:12:42 -0400 Subject: [PATCH] re PR c++/50508 ([C++0x] ICE cxx_eval_logical_expression cp/semantics.c:6487) PR c++/50508 * semantics.c (cxx_eval_logical_expression): Use tree_int_cst_equal rather than ==. From-SVN: r179228 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/semantics.c | 4 ++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/constexpr-typedef1.C | 11 +++++++++++ 4 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-typedef1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9de69c86472..0efa0d682e7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-09-26 Jason Merrill + + PR c++/50508 + * semantics.c (cxx_eval_logical_expression): Use tree_int_cst_equal + rather than ==. + 2011-09-26 Paolo Carlini PR c++/45487 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 19ecbee4d8a..89c76d5a126 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ebc9385a111..bc362edf21b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-09-26 Jason Merrill + + PR c++/50508 + * g++.dg/cpp0x/constexpr-typedef1.C: New. + 2011-09-26 Paolo Carlini 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 index 00000000000..2719e3aea12 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-typedef1.C @@ -0,0 +1,11 @@ +// PR c++/50508 +// { dg-options -std=c++0x } + +template + struct integral_constant { + typedef T value_type; + constexpr operator value_type() { return true; } + }; + +static constexpr bool value = integral_constant() + && true;