From: Paolo Carlini Date: Fri, 5 May 2017 09:02:22 +0000 (+0000) Subject: re PR c++/71577 (ICE on invalid C++11 code (with extra struct initializer): in digest... X-Git-Tag: basepoints/gcc-9~7551 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dfae9048a0ce06a8f240dd17c282cb1e1eaf2097;p=thirdparty%2Fgcc.git re PR c++/71577 (ICE on invalid C++11 code (with extra struct initializer): in digest_init_r, at cp/typeck2.c:1117) /cp 2017-05-05 Paolo Carlini PR c++/71577 * decl.c (reshape_init): Unconditionally return error_mark_node upon error about too many initializers. /testsuite 2017-05-05 Paolo Carlini PR c++/71577 * g++.dg/cpp0x/pr71577.C: New. From-SVN: r247630 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ac7c0339c214..768f5a3614fd 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-05-05 Paolo Carlini + + PR c++/71577 + * decl.c (reshape_init): Unconditionally return error_mark_node + upon error about too many initializers. + 2017-05-04 Nathan Sidwell * constraint.cc (diagnose_check_constraint): Fix %E thinko. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 6a7aeb3f7b38..38ba0b0abd2a 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6116,8 +6116,7 @@ reshape_init (tree type, tree init, tsubst_flags_t complain) { 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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0d54e4ceaecb..f9ac3346a7a1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-05-05 Paolo Carlini + + PR c++/71577 + * g++.dg/cpp0x/pr71577.C: New. + 2017-05-04 Martin Sebor PR middle-end/79234 diff --git a/gcc/testsuite/g++.dg/cpp0x/pr71577.C b/gcc/testsuite/g++.dg/cpp0x/pr71577.C new file mode 100644 index 000000000000..15794ad62cb6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr71577.C @@ -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" }