Commit dc3ca06f by Simon Martin Committed by Simon Martin

re PR c++/33207 (ICE redeclaring namespace as struct)

gcc/cp/

2007-09-25  Simon Martin  <simartin@users.sourceforge.net>
        
	PR c++/33207
	* name-lookup.c (pushtag): Do not create an implicit typedef before
	the associated type declaration is known to be valid.

gcc/testsuite/

2007-09-25  Simon Martin  <simartin@users.sourceforge.net>

	PR c++/33207
	* g++.dg/parse/crash38.C: New test.

From-SVN: r128769
parent 53a83348
2007-09-25 Simon Martin <simartin@users.sourceforge.net>
PR c++/33207
* name-lookup.c (pushtag): Do not create an implicit typedef before
the associated type declaration is known to be valid.
2007-09-25 Jakub Jelinek <jakub@redhat.com> 2007-09-25 Jakub Jelinek <jakub@redhat.com>
* tree.c (cxx_printable_name): Compare FUNCTION_DECL uids * tree.c (cxx_printable_name): Compare FUNCTION_DECL uids
......
...@@ -4944,9 +4944,6 @@ pushtag (tree name, tree type, tag_scope scope) ...@@ -4944,9 +4944,6 @@ pushtag (tree name, tree type, tag_scope scope)
if (decl == error_mark_node) if (decl == error_mark_node)
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
if (! in_class)
set_identifier_type_value_with_scope (name, tdef, b);
if (b->kind == sk_class) if (b->kind == sk_class)
{ {
if (!PROCESSING_REAL_TEMPLATE_DECL_P ()) if (!PROCESSING_REAL_TEMPLATE_DECL_P ())
...@@ -4965,6 +4962,9 @@ pushtag (tree name, tree type, tag_scope scope) ...@@ -4965,6 +4962,9 @@ pushtag (tree name, tree type, tag_scope scope)
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
} }
if (! in_class)
set_identifier_type_value_with_scope (name, tdef, b);
TYPE_CONTEXT (type) = DECL_CONTEXT (decl); TYPE_CONTEXT (type) = DECL_CONTEXT (decl);
/* If this is a local class, keep track of it. We need this /* If this is a local class, keep track of it. We need this
......
2007-09-25 Simon Martin <simartin@users.sourceforge.net>
PR c++/33207
* g++.dg/parse/crash38.C: New test.
2007-09-25 Michael Meissner <michael.meissner@amd.com> 2007-09-25 Michael Meissner <michael.meissner@amd.com>
PR c/33524 PR c/33524
/* PR c++/33207 */
/* This would not ICE. */
namespace M { } /* { dg-error "previous declaration" } */
struct M; /* { dg-error "redeclared as different kind of symbol" } */
M *p; /* { dg-error "expected constructor" } */
/* This would ICE when processing 'p'. */
namespace N { } /* { dg-error "previous declaration" } */
struct N; /* { dg-error "redeclared as different kind of symbol" } */
struct N* p; /* { dg-error "redeclared as different kind of symbol|invalid type" } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment