D - dynamic_cast only?
Vladimir Panteleev
vladimir at thecybershadow.net
Sun Dec 25 06:01:31 PST 2011
On Sunday, 25 December 2011 at 13:39:15 UTC, Steve Teale wrote:
> The segfault is presumably because Widget does not have a
> setCurrentColor method, but why is the cast being ignored? Is
> the compiler optimizing the intermediate cast to void away? I
> don't find the asm from obj2asm helpful.
I don't understand. Casting a void* to a class bypasses all
static type checks. This is one of those cases where you "tell
the compiler that you know what you're doing" - and if you try to
call a method that wasn't in the original class's vtable, that's
obviously not true.
More information about the Digitalmars-d
mailing list