[Interest] dynamic_cast failing

Nikos Chantziaras realnc at gmail.com
Sat Apr 11 17:31:38 CEST 2015


On 11/04/15 18:08, René J.V. Bertin wrote:
> Hi,
>
> I have an issue with some KDE4 code (built against Qt 4.8.6) where a
> dynamic_cast fails on OS X but not on Linux (be it with gcc or clang
> 3.5).

You might be hitting some undefined behavior. Do your classes have 
virtual functions? If not, dynamic_cast can fail, as it's only supposed 
to work with polymorphic classes.

To ensure your classes are polymorphic, give them virtual destructors 
(even if they are empty.)




More information about the Interest mailing list