Patch: PR c++/28114: Check for error_mark_node

Steve Ellcey sje@cup.hp.com
Thu Jun 22 15:05:00 GMT 2006


This patch checks to see if pushdecl_with_scope returned an
error_mark_node and does an early return if it gets one.  This avoids
the ICE.  It does not change the error messages that are put out though.

y.C:1: error: template class without a name
y.C:1: error: types may not be defined in parameter types
y.C:5: error: conflicting declaration 'struct<anonymous>'
y.C:5: error: 'struct<anonymous>' has a previous declaration as 'struct<anonymou
s>'
y.C: In function 'void bar()':
y.C:5: error: no matching function for call to 'foo(int)'

OK to checkin?

Steve Ellcey
sje@cup.hp.com



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

	PR c++/28114
	* cp/name-lookup.c (pushtag): Return if we have error_mark_node.

Index: cp/name-lookup.c
===================================================================
--- cp/name-lookup.c	(revision 114878)
+++ cp/name-lookup.c	(working copy)
@@ -4872,7 +4872,11 @@ pushtag (tree name, tree type, tag_scope
 	    pushdecl_class_level (decl);
 	}
       else if (b->kind != sk_template_parms)
-	decl = pushdecl_with_scope (decl, b, /*is_friend=*/false);
+	{
+	  decl = pushdecl_with_scope (decl, b, /*is_friend=*/false);
+	  if (decl == error_mark_node)
+	    POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
+	}
 
       TYPE_CONTEXT (type) = DECL_CONTEXT (decl);
 



More information about the Gcc-patches mailing list