commit a9c72513517e8b5cbf3128cb89994eae59961ade
Author: Jason Merrill <jason@redhat.com>
Date: Fri Aug 5 16:51:08 2011 -0400
PR c++/49669
* init.c (perform_member_init): Handle invalid array initializer.
@@ -554,8 +554,10 @@ perform_member_init (tree member, tree init)
{
if (init)
{
- gcc_assert (TREE_CHAIN (init) == NULL_TREE);
- init = TREE_VALUE (init);
+ if (TREE_CHAIN (init))
+ init = error_mark_node;
+ else
+ init = TREE_VALUE (init);
if (BRACE_ENCLOSED_INITIALIZER_P (init))
init = digest_init (type, init, tf_warning_or_error);
}
new file mode 100644
@@ -0,0 +1,7 @@
+// PR c++/49669
+
+struct Foo { explicit Foo(int) { } };
+struct Goo {
+ Goo() : x(Foo(4), Foo(5)) { } // { dg-error "array" }
+ Foo x[2];
+};