C++ PATCH: fix PR 28687

Benjamin Smedberg benjamin@smedbergs.us
Fri Aug 11 21:29:00 GMT 2006


Gabriel Dos Reis wrote:
> Benjamin Smedberg <benjamin@smedbergs.us> writes:
> 
> | Previously the construct dynamic_cast<void*> worked even when RTTI was
> | disabled, and was useful in Mozilla logging code. PR10891 changed this
> | behavior so that dynamic_cast is forbidden unconditionally when -fno-rtti is
> | used.
> 
> That assertion is untrue.  The documentation for -fno-rtti is clear
> about the dynamic_cast.  If -fno-rtti, you can't meaningfully do
> dynamic_cast<void*>.   

Which one? That it worked previously is a statement of fact, not really 
disputable. Mozilla logging code would be a shambles if this were not the case.

That it continues to work is a matter of logic and code examination. The 
code in question is in build_headof() in rtti.c: the offset from a pointer 
to the most-derived class pointer is contained in the vtable in position -2. 
No RTTI symbol lookups are performed during this process.

--BDS



More information about the Gcc-patches mailing list