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
This commit is contained in:
Jason Merrill 2011-03-28 11:49:45 -04:00 committed by Jason Merrill
parent 7450b54f84
commit 0309d28824
4 changed files with 25 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2011-03-28 Jason Merrill <jason@redhat.com>
* except.c (build_noexcept_spec): Call cxx_constant_value after
converting to bool.
2011-03-25 Kai Tietz <ktietz@redhat.com>
* lex.c (interface_strcmp): Handle dos-paths.

View File

@ -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;

View File

@ -1,3 +1,7 @@
2011-03-28 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/constexpr-noexcept.C: New.
2011-03-28 H.J. Lu <hongjiu.lu@intel.com>
PR testsuite/48276

View File

@ -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;
}