https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115470
Bug ID: 115470 Summary: bad_typeid is not thrown for typeid(*null pointer) of final class Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: user202729 at protonmail dot com Target Milestone: --- For the following code, gcc does nothing, while clang throws a bad_typeid. #include<typeinfo> struct D { virtual void f() {} }; struct C final : D { }; void h(){ typeid(*(C*)0); } Godbolt link: https://godbolt.org/z/GohvfMMhr Clang does throw a bad_typeid exception.