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: PR c++/27019 - set error_mark_node


This patch sets an initializer value to error_mark_node when a bad
initializer is found so that later code does not ICE on invalid code.

Tested on IA64 HP-UX with no regressions.

OK for checkin?

Steve Ellcey
sje@cup.hp.com


2006-06-22  Steve Ellcey  <sje@cup.hp.com>

	PR c++/27019
	* cp/typeck2.c (process_init_constructor_array): Set ce->value on
	errors.

Index: cp/typeck2.c
===================================================================
--- cp/typeck2.c	(revision 114878)
+++ cp/typeck2.c	(working copy)
@@ -797,7 +797,10 @@ process_init_constructor_array (tree typ
 	{
 	  gcc_assert (TREE_CODE (ce->index) == INTEGER_CST);
 	  if (compare_tree_int (ce->index, i) != 0)
-	    sorry ("non-trivial designated initializers not supported");
+	    {
+	      ce->value = error_mark_node;
+	      sorry ("non-trivial designated initializers not supported");
+	    }
 	}
       else
 	ce->index = size_int (i);
@@ -895,7 +898,10 @@ process_init_constructor_record (tree ty
 			  || TREE_CODE (ce->index) == IDENTIFIER_NODE);
 	      if (ce->index != field
 		  && ce->index != DECL_NAME (field))
-		sorry ("non-trivial designated initializers not supported");
+		{
+		  ce->value = error_mark_node;
+		  sorry ("non-trivial designated initializers not supported");
+		}
 	    }
 
 	  gcc_assert (ce->value);


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