diff mbox

[C++] PR 51399

Message ID 4EDD14CC.2070509@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Dec. 5, 2011, 7 p.m. UTC
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.carlini@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.carlini@oracle.com>

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

Comments

Jason Merrill Dec. 5, 2011, 8:17 p.m. UTC | #1
OK.

Jason
diff mbox

Patch

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)