PR c++/92009 - ICE with punning of typeid.
authorJason Merrill <jason@redhat.com>
Tue, 14 Jan 2020 05:05:47 +0000 (00:05 -0500)
committerJason Merrill <jason@redhat.com>
Tue, 14 Jan 2020 16:57:34 +0000 (11:57 -0500)
commit80de0002429c74626198cefa168c3081c9d90566
tree75dab2481c042655ada32a010a12ab43732fc35d
parent336da03cc3a1795942938c6187277b666ce9b86c
PR c++/92009 - ICE with punning of typeid.

There were two issues in this PR:

1) We were crashing in is_really_empty_class because we say that the
internal RTTI types are classes, but never gave them TYPE_BINFO.

2) We were allowing the cast to a different pointer type because STRIP_NOPS
in cxx_fold_indirect_ref ignored REINTERPRET_CAST_P.

* rtti.c (get_tinfo_desc): Call xref_basetypes.
* constexpr.c (cxx_fold_indirect_ref): Don't strip
REINTERPRET_CAST_P.
gcc/cp/ChangeLog
gcc/cp/constexpr.c
gcc/cp/rtti.c
gcc/testsuite/g++.dg/cpp0x/constexpr-reinterpret2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/rtti/typeid13.C [new file with mode: 0644]