On 12/21/2011 04:44 PM, Jason Merrill wrote:
If reordering works, let's just do that.
Sure. Then I'm going to apply the below when re-testing completes. Thanks!
Paolo.
///////////////////
/cp
2011-12-21 Paolo Carlini <[email protected]>
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 <[email protected]>
PR c++/51305
* g++.dg/cpp0x/constexpr-noexcept6.C: New.
Index: testsuite/g++.dg/cpp0x/constexpr-noexcept6.C
===================================================================
--- testsuite/g++.dg/cpp0x/constexpr-noexcept6.C (revision 0)
+++ testsuite/g++.dg/cpp0x/constexpr-noexcept6.C (revision 0)
@@ -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();
Index: cp/semantics.c
===================================================================
--- cp/semantics.c (revision 182590)
+++ cp/semantics.c (working copy)
@@ -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;