Message ID | 0e71a2d6-ae7b-36dd-a9e5-c50c207f8a35@oracle.com |
---|---|
State | New |
Headers | show |
On 04/28/2017 06:58 AM, Paolo Carlini wrote: > 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. PR c++/71577 * decl.c (reshape_init): Unconditionally return error_mark_node upon error about too many initializers. ok
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" }