RTTI of local classes

Christophe de Dinechin ddd at cup.hp.com
Wed Mar 22 00:57:55 UTC 2000


You can make this work by having the mangling for any static function include
the file name. I raised a similar issue for static variables in static
functions.

Christophe


Martin von Loewis wrote:
> 
> I was just reviewing the RTTI spec and see that type_info equalness is
> based on type name mangling; this seems to be the right solution.
> 
> However, I think there are examples that break under that scheme:
> 
> struct Base{
>   virtual ~Base();
> };
> 
> static bool foo(Base* x){
>   struct Derived:Base{};
>   Base *y = new Derived;
>   return typeid(*x)==typeid(*y);
> }
> 
> typeinfo(*y).name() would be "Z3fooP4BaseE1_", right? Now, that could
> also be the name of *x, if that was created in a different translation
> unit, which also has a function foo(Base*) with a local type Derived.
> 
> I'm not sure about a conclusion. Is that well-formed C++ code with a
> well-defined behaviour? Does our ABI support that? Should it? Is that
> a defect in C++, as it is unimplementable?
> 
> Comments appreciated,
> Martin




More information about the cxx-abi-dev mailing list