From: Jason Merrill Date: Mon, 28 Mar 2011 15:49:45 +0000 (-0400) Subject: except.c (build_noexcept_spec): Call cxx_constant_value after converting to bool. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0309d28824f040972a212183b34c45d59449b529;p=gcc.git except.c (build_noexcept_spec): Call cxx_constant_value after converting to bool. * except.c (build_noexcept_spec): Call cxx_constant_value after converting to bool. From-SVN: r171609 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 597093e0374..3bbeddf8c64 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2011-03-28 Jason Merrill + + * except.c (build_noexcept_spec): Call cxx_constant_value after + converting to bool. + 2011-03-25 Kai Tietz * lex.c (interface_strcmp): Handle dos-paths. diff --git a/gcc/cp/except.c b/gcc/cp/except.c index c05e507574c..a814d678658 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -1203,10 +1203,10 @@ build_noexcept_spec (tree expr, int complain) it until instantiation. */ if (!processing_template_decl) { - expr = cxx_constant_value (expr); expr = perform_implicit_conversion_flags (boolean_type_node, expr, complain, LOOKUP_NORMAL); + expr = cxx_constant_value (expr); } if (expr == boolean_true_node) return noexcept_true_spec; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 53424d290b5..863f5994587 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-03-28 Jason Merrill + + * g++.dg/cpp0x/constexpr-noexcept.C: New. + 2011-03-28 H.J. Lu PR testsuite/48276 diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept5.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept5.C new file mode 100644 index 00000000000..7bf961b3c45 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept5.C @@ -0,0 +1,15 @@ +// { dg-options -std=c++0x } + +struct booleable { + bool data; + constexpr explicit operator bool() { return data; } +}; + +constexpr booleable truthy_func() { return {true}; } + +void funky() noexcept(truthy_func()) {} + +int main() { + funky(); + return 0; +}