This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]