public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115470] New: bad_typeid is not thrown for typeid(*null pointer) of final class
@ 2024-06-13 5:40 user202729 at protonmail dot com
2024-06-13 7:49 ` [Bug c++/115470] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: user202729 at protonmail dot com @ 2024-06-13 5:40 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-13 7:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-13 5:40 [Bug c++/115470] New: bad_typeid is not thrown for typeid(*null pointer) of final class user202729 at protonmail dot com
2024-06-13 7:49 ` [Bug c++/115470] " pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).