[PATCH] Fix PR c++/33207: ICE redeclaring namespace as struct

Mark Mitchell mark@codesourcery.com
Sun Sep 9 19:36:00 GMT 2007


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



More information about the Gcc-patches mailing list