This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR c++/33207: ICE redeclaring namespace as struct
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Simon Martin <simartin at users dot sourceforge dot net>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 09 Sep 2007 12:26:28 -0700
- Subject: Re: [PATCH] Fix PR c++/33207: ICE redeclaring namespace as struct
- References: <46E23822.308@users.sourceforge.net>
Simon Martin wrote:
> Hi all.
>
> The following code snippet triggers an ICE with the mainline:
>
> === cut here ===
> namespace N { }
> struct N;
> struct N* p;
> === cut here ===
>
> The problem is that the type for 'struct N', when processed by
> 'pushtag', is not completely setup: we leave the function earlier
> because we end up with error_mark_node after 'pushdecl_with_scope' since
> N is already the name of a namespace. In particular, the type's
> TYPE_STUB_DECL is not set, so it (and TYPE_MAIN_DECL) remains NULL_TREE.
The guiding principle is that we don't want the internal representation
to represent an erroneous program; too many things can go wrong. So, it
would be better not have a type at all in this case. Is that feasible?
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713