===================================================================
@@ -0,0 +1,6 @@
+// PR c++/52599
+// { dg-options -std=c++11 }
+
+struct foo {
+ constexpr foo() try { } catch(...) { }; // { dg-error "constructor" }
+};
===================================================================
@@ -5921,6 +5921,12 @@ build_constexpr_constructor_member_initializers (t
break;
}
}
+ else if (TREE_CODE (body) == TRY_BLOCK)
+ {
+ error ("body of %<constexpr%> constructor cannot be "
+ "a function-try-block");
+ return error_mark_node;
+ }
else if (EXPR_P (body))
ok = build_data_member_initialization (body, &vec);
else