Polymorphically catching an exception in a -fno-rtti shared library on Mac OS X

扶醉桌前 提交于 2019-12-05 07:49:24

Turns out this a bug on Apple's gcc. They've recently replied to my bug report saying it won't be fixed, though.

From the info page for gcc (my highlighing).

-fno-rtti Disable generation of information about every class with virtual functions for use by the C++ runtime type identification features (dynamic_cast and typeid). If you don't use those parts of the language, you can save some space by using this flag. Note that exception handling uses the same information, but it will generate it as needed. The dynamic_cast operator can still be used for casts that do not require runtime type information, i.e. casts to void * or to unambiguous base classes.

RTTI is a core part of the language. If the compiler allows you to disable it, you're working outside of the rules of the language so aren't necessarily going to have everything work as you expect.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!