From 0309d28824f040972a212183b34c45d59449b529 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 28 Mar 2011 11:49:45 -0400 Subject: [PATCH] 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 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/except.c | 2 +- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept5.C | 15 +++++++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept5.C 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; +} -- 2.30.2