This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: Fix for regression PR c++/28291


Here is a patch (and testcase) for the regression PR c++/28291.  Tested
on IA64 HP-UX and Linux.  I would also like to check it in on the 4.1
branch since it is listed as a 4.1 regression.

OK for checkin?

Steve Ellcey
sje@cup.hp.com

2006-07-14  Steve Ellcey  <sje@cup.hp.com>

	PR c++/28291
	* cp/decl.c (reshape_init_class): Return error_mark_node on error.

Index: decl.c
===================================================================
--- decl.c	(revision 115430)
+++ decl.c	(working copy)
@@ -4505,8 +4505,11 @@ reshape_init_class (tree type, reshape_i
 	  field = lookup_field_1 (type, d->cur->index, /*want_type=*/false);
 
 	  if (!field || TREE_CODE (field) != FIELD_DECL)
-	    error ("%qT has no non-static data member named %qD", type,
-		  d->cur->index);
+	    {
+	      error ("%qT has no non-static data member named %qD", type,
+		    d->cur->index);
+	      return error_mark_node;
+	    }
 	}
 
       /* If we processed all the member of the class, we are done.  */



2006-07-14  Steve Ellcey  <sje@cup.hp.com>

	PR c++/28291
	* g++.dg/ext/pr28291.C: New test.

Index: g++.dg/ext/pr28291.C
===================================================================
--- g++.dg/ext/pr28291.C	(revision 0)
+++ g++.dg/ext/pr28291.C	(revision 0)
@@ -0,0 +1,13 @@
+
+// Test to make sure we do not ICE on this invalid program.
+
+// { dg-do compile }
+// { dg-options "" }
+
+struct A
+{
+  static int i;
+  int j;
+};
+
+A a = { i:0 }; // { dg-error "non-static data member" }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]