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.

Reply via email to