Hi,

now that 7.1.0 is almost out of the door, I'm sending a few simple patches which I have been testing for a while in my trees. This one is about an error recovery regression: I think it's correct to handle it by simply returning unconditionally error_mark_node upon "too many initializers" error. Tested x86_64-linux.

Thanks, Paolo.

//////////////////

/cp
2017-04-28  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/71577
        * decl.c (reshape_init): Unconditionally return error_mark_node
        upon error about too many initializers.

/testsuite
2017-04-28  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/71577
        * g++.dg/cpp0x/pr71577.C: New.
Index: cp/decl.c
===================================================================
--- cp/decl.c   (revision 247273)
+++ cp/decl.c   (working copy)
@@ -6118,8 +6118,7 @@ reshape_init (tree type, tree init, tsubst_flags_t
     {
       if (complain & tf_error)
        error ("too many initializers for %qT", type);
-      else
-       return error_mark_node;
+      return error_mark_node;
     }
 
   if (CONSTRUCTOR_IS_DIRECT_INIT (init)
Index: testsuite/g++.dg/cpp0x/pr71577.C
===================================================================
--- testsuite/g++.dg/cpp0x/pr71577.C    (revision 0)
+++ testsuite/g++.dg/cpp0x/pr71577.C    (working copy)
@@ -0,0 +1,4 @@
+// PR c++/71577
+// { dg-do compile { target c++11 } }
+
+struct { int a; } s1, s2 = { s1, 0 };  // { dg-error "too many initializers" }

Reply via email to