2014-07-13 Jason Merrill <jason@redhat.com>
+ PR c++/58611
+ * decl.c (check_initializer): Don't finish_compound_literal
+ on erroneous constexpr init.
+
PR c++/58612
* tree.c (bot_replace): Only replace a dummy 'this' parm.
/* Declared constexpr, but no suitable initializer; massage
init appropriately so we can pass it into store_init_value
for the error. */
- if (init && BRACE_ENCLOSED_INITIALIZER_P (init))
- init = finish_compound_literal (type, init,
- tf_warning_or_error);
- else if (CLASS_TYPE_P (type)
- && (!init || TREE_CODE (init) == TREE_LIST))
+ if (CLASS_TYPE_P (type)
+ && (!init || TREE_CODE (init) == TREE_LIST))
{
init = build_functional_cast (type, init, tf_none);
if (TREE_CODE (init) == TARGET_EXPR)
--- /dev/null
+// PR c++/58611
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+ int i;
+ constexpr A() {} // { dg-error "A::i" }
+};
+
+struct B
+{
+ A a;
+};
+
+constexpr B b[] = { {} }; // { dg-error "A::A" }