Hi,
Let's exit earlier on error_mark_node, as it seems there are other places in the function that might do the wrong thing.
Good. The below also passes testing on x86_64-linux.

Thanks,
Paolo.

////////////////////
/cp
2011-12-05  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/51399
        * init.c (perform_member_init): Early return if init is error_mark_node.

/testsuite
2011-12-05  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/51399
        * g++.dg/cpp0x/initlist62.C: New.



Index: testsuite/g++.dg/cpp0x/initlist62.C
===================================================================
--- testsuite/g++.dg/cpp0x/initlist62.C (revision 0)
+++ testsuite/g++.dg/cpp0x/initlist62.C (revision 0)
@@ -0,0 +1,10 @@
+// PR c++/51399
+// { dg-options "-std=c++0x" }
+
+#include <initializer_list>
+
+struct A
+{
+  std::initializer_list<int> x[1] = { 0 };  // { dg-error "could not convert" }
+  A() {}
+};
Index: cp/init.c
===================================================================
--- cp/init.c   (revision 182016)
+++ cp/init.c   (working copy)
@@ -542,6 +542,9 @@ perform_member_init (tree member, tree init)
        }
     }
 
+  if (init == error_mark_node)
+    return;
+
   /* Effective C++ rule 12 requires that all data members be
      initialized.  */
   if (warn_ecpp && init == NULL_TREE && TREE_CODE (type) != ARRAY_TYPE)

Reply via email to