This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch: PR c++/28114: Check for error_mark_node
- From: Steve Ellcey <sje at cup dot hp dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 22 Jun 2006 08:00:06 -0700 (PDT)
- Subject: Patch: PR c++/28114: Check for error_mark_node
- Reply-to: sje at cup dot hp dot com
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);