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++/28114: Check for error_mark_node


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);
 


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