2011-06-29 Jason Merrill <jason@redhat.com>
+ PR c++/49520
+ * semantics.c (constexpr_fn_retval): Handle CLEANUP_POINT_EXPR here.
+ (massage_constexpr_body): Not here.
+
PR c++/49554
* semantics.c (lambda_proxy_type): New.
(build_capture_proxy): Use it.
DEFTREECODE (USING_DECL, "using_decl", tcc_declaration, 0)
/* A using directive. The operand is USING_STMT_NAMESPACE. */
-DEFTREECODE (USING_STMT, "using_directive", tcc_statement, 1)
+DEFTREECODE (USING_STMT, "using_stmt", tcc_statement, 1)
/* An un-parsed default argument. Holds a vector of input tokens and
a vector of places where the argument was instantiated before
return NULL_TREE;
return error_mark_node;
+ case CLEANUP_POINT_EXPR:
+ return constexpr_fn_retval (TREE_OPERAND (body, 0));
+
case USING_STMT:
return NULL_TREE;
body = EH_SPEC_STMTS (body);
if (TREE_CODE (body) == MUST_NOT_THROW_EXPR)
body = TREE_OPERAND (body, 0);
- if (TREE_CODE (body) == CLEANUP_POINT_EXPR)
- body = TREE_OPERAND (body, 0);
body = constexpr_fn_retval (body);
}
return body;
2011-06-29 Jason Merrill <jason@redhat.com>
+ PR c++/49520
+ * g++.dg/cpp0x/constexpr-using2.C: New.
+
* g++.dg/cpp0x/lambda/lambda-template3.C: New.
PR c++/45923
--- /dev/null
+// PR c++/49520
+// { dg-options -std=c++0x }
+
+namespace x { void foo(); }
+
+template<typename T>
+struct traits
+{
+ static constexpr bool f() { return true; }
+
+ static constexpr bool g()
+ {
+ using x::foo;
+ return f() && noexcept(foo());
+ }
+};
+
+template struct traits<int>;