re PR c++/51305 ([C++11][constexpr] noexcept-specifier overconstraints constexpr functions)

/cp
2011-12-21  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51305
	* semantics.c (massage_constexpr_body): Reorder conditionals, make
	sure a BIND_EXPR embedded in a MUST_NOT_THROW_EXPR is handled.

/testsuite
2011-12-21  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51305
	* g++.dg/cpp0x/constexpr-noexcept6.C: New.

From-SVN: r182594
This commit is contained in:
Paolo Carlini 2011-12-21 16:28:08 +00:00 committed by Paolo Carlini
parent b0f96e350a
commit 65a6f60960
4 changed files with 23 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2011-12-21 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51305
* semantics.c (massage_constexpr_body): Reorder conditionals, make
sure a BIND_EXPR embedded in a MUST_NOT_THROW_EXPR is handled.
2011-12-20 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51621

View File

@ -5998,12 +5998,12 @@ massage_constexpr_body (tree fun, tree body)
(DECL_CONTEXT (fun), body);
else
{
if (TREE_CODE (body) == BIND_EXPR)
body = BIND_EXPR_BODY (body);
if (TREE_CODE (body) == EH_SPEC_BLOCK)
body = EH_SPEC_STMTS (body);
if (TREE_CODE (body) == MUST_NOT_THROW_EXPR)
body = TREE_OPERAND (body, 0);
if (TREE_CODE (body) == BIND_EXPR)
body = BIND_EXPR_BODY (body);
body = constexpr_fn_retval (body);
}
return body;

View File

@ -1,3 +1,8 @@
2011-12-21 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51305
* g++.dg/cpp0x/constexpr-noexcept6.C: New.
2011-12-21 Jakub Jelinek <jakub@redhat.com>
PR middle-end/51644

View File

@ -0,0 +1,10 @@
// PR c++/51305
// { dg-options -std=c++0x }
constexpr bool ok() noexcept
{
typedef int type;
return true;
}
constexpr auto x = ok();