public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ Patch] PR 71577 ("[6/7/8 regression] ICE on invalid C++11 code (with extra struct initializer): in digest_init_r...")
@ 2017-04-28 11:27 Paolo Carlini
  2017-04-28 14:52 ` Nathan Sidwell
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Carlini @ 2017-04-28 11:27 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

[-- Attachment #1: Type: text/plain, Size: 363 bytes --]

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.

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


[-- Attachment #2: CL_71577 --]
[-- Type: text/plain, Size: 292 bytes --]

/cp
2017-04-28  Paolo Carlini  <paolo.carlini@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.carlini@oracle.com>

	PR c++/71577
	* g++.dg/cpp0x/pr71577.C: New.

[-- Attachment #3: patch_71577 --]
[-- Type: text/plain, Size: 790 bytes --]

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" }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [C++ Patch] PR 71577 ("[6/7/8 regression] ICE on invalid C++11 code (with extra struct initializer): in digest_init_r...")
  2017-04-28 11:27 [C++ Patch] PR 71577 ("[6/7/8 regression] ICE on invalid C++11 code (with extra struct initializer): in digest_init_r...") Paolo Carlini
@ 2017-04-28 14:52 ` Nathan Sidwell
  0 siblings, 0 replies; 2+ messages in thread
From: Nathan Sidwell @ 2017-04-28 14:52 UTC (permalink / raw)
  To: Paolo Carlini, gcc-patches; +Cc: Jason Merrill

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
-- 
Nathan Sidwell

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-28 14:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-28 11:27 [C++ Patch] PR 71577 ("[6/7/8 regression] ICE on invalid C++11 code (with extra struct initializer): in digest_init_r...") Paolo Carlini
2017-04-28 14:52 ` Nathan Sidwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).