aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/name-lookup.c
diff options
context:
space:
mode:
authorKriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>2004-11-29 14:17:33 +0000
committerKriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org>2004-11-29 14:17:33 +0000
commitc6f9f83bc8e66feb890dc0c9804b59060b5a108e (patch)
tree21a12e4b14b7728e3120b2ee3c55077458e781b7 /gcc/cp/name-lookup.c
parent4f70f9d237bd16869e6f6146b3709cbefa3dffe9 (diff)
downloadgcc-c6f9f83bc8e66feb890dc0c9804b59060b5a108e.zip
gcc-c6f9f83bc8e66feb890dc0c9804b59060b5a108e.tar.gz
gcc-c6f9f83bc8e66feb890dc0c9804b59060b5a108e.tar.bz2
re PR c++/18652 (ICE on invalid redeclaration)
PR c++/18652 * name-lookup.c (pushtag): Change return type to tree. * cp-tree.h (pushtag): Adjust declaration. * decl.c (xref_tag, start_enum): Use return value of pushtag. * pt.c (push_template_decl_real): Return immediately if pushdecl_namespace_level returns error_mark_node. * g++.dg/lookup/crash6.C: New test. From-SVN: r91470
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r--gcc/cp/name-lookup.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index ddbd78f..ee0d1a4 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -4566,9 +4566,10 @@ maybe_process_template_type_declaration (tree type, int globalize,
/* Push a tag name NAME for struct/class/union/enum type TYPE.
Normally put it into the inner-most non-sk_cleanup scope,
but if GLOBALIZE is true, put it in the inner-most non-class scope.
- The latter is needed for implicit declarations. */
+ The latter is needed for implicit declarations.
+ Returns TYPE upon success and ERROR_MARK_NODE otherwise. */
-void
+tree
pushtag (tree name, tree type, int globalize)
{
struct cp_binding_level *b;
@@ -4633,6 +4634,8 @@ pushtag (tree name, tree type, int globalize)
d = maybe_process_template_type_declaration (type,
globalize, b);
+ if (d == error_mark_node)
+ return error_mark_node;
if (b->kind == sk_class)
{
@@ -4695,7 +4698,7 @@ pushtag (tree name, tree type, int globalize)
tree d = build_decl (TYPE_DECL, NULL_TREE, type);
TYPE_STUB_DECL (type) = pushdecl_with_scope (d, b);
}
- timevar_pop (TV_NAME_LOOKUP);
+ POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, type);
}
/* Subroutines for reverting temporarily to top-level for instantiation