aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/rtti.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2020-01-14 00:05:47 -0500
committerJason Merrill <jason@redhat.com>2020-01-14 11:57:34 -0500
commit80de0002429c74626198cefa168c3081c9d90566 (patch)
tree75dab2481c042655ada32a010a12ab43732fc35d /gcc/cp/rtti.c
parent336da03cc3a1795942938c6187277b666ce9b86c (diff)
downloadgcc-80de0002429c74626198cefa168c3081c9d90566.zip
gcc-80de0002429c74626198cefa168c3081c9d90566.tar.gz
gcc-80de0002429c74626198cefa168c3081c9d90566.tar.bz2
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.
Diffstat (limited to 'gcc/cp/rtti.c')
-rw-r--r--gcc/cp/rtti.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 2fc52f0..36c1b4e 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -1472,6 +1472,7 @@ get_tinfo_desc (unsigned ix)
/* Pass the fields chained in reverse. */
finish_builtin_struct (pseudo_type, pseudo_name, fields, NULL_TREE);
CLASSTYPE_AS_BASE (pseudo_type) = pseudo_type;
+ xref_basetypes (pseudo_type, /*bases=*/NULL_TREE);
res->type = cp_build_qualified_type (pseudo_type, TYPE_QUAL_CONST);
res->name = get_identifier (real_name);