aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2021-05-18 17:15:42 -0400
committerJason Merrill <jason@redhat.com>2021-05-18 20:26:47 -0400
commit01b2864757540d24c4e717a77b40b29369c064b2 (patch)
tree78a80919757d43aa37a5c6cdc1f630b3208b4e32
parent061fe8c58ac4d436906a404f7fb46b0a6e0d7b4f (diff)
downloadgcc-01b2864757540d24c4e717a77b40b29369c064b2.zip
gcc-01b2864757540d24c4e717a77b40b29369c064b2.tar.gz
gcc-01b2864757540d24c4e717a77b40b29369c064b2.tar.bz2
c++: ICE with bad definition of decimal32 [PR100261]
The change to only look at the global binding for non-classes meant that here, when dealing with decimal32 which is magically mangled like its first non-static data member, we got a collision with the mangling for float. Fixed by also looking up an existing binding for such magical classes. PR c++/100261 gcc/cp/ChangeLog: * rtti.c (get_tinfo_decl_direct): Check TYPE_TRANSPARENT_AGGR. gcc/testsuite/ChangeLog: * g++.dg/dfp/mangle-6.C: New test.
-rw-r--r--gcc/cp/rtti.c2
-rw-r--r--gcc/testsuite/g++.dg/dfp/mangle-6.C19
2 files changed, 20 insertions, 1 deletions
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 5a33b83..82eaa28 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -433,7 +433,7 @@ get_tinfo_decl_direct (tree type, tree name, int pseudo_ix)
if (!name)
name = mangle_typeinfo_for_type (type);
- if (!CLASS_TYPE_P (type))
+ if (!CLASS_TYPE_P (type) || TYPE_TRANSPARENT_AGGR (type))
d = get_global_binding (name);
if (!d)
diff --git a/gcc/testsuite/g++.dg/dfp/mangle-6.C b/gcc/testsuite/g++.dg/dfp/mangle-6.C
new file mode 100644
index 0000000..9cfb2a9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/dfp/mangle-6.C
@@ -0,0 +1,19 @@
+// PR c++/100261
+// { dg-do compile }
+
+#include <typeinfo>
+
+namespace std {
+ namespace decimal {
+ class decimal32 {
+ float private__decfloat32;
+ };
+ }
+}
+
+void
+foo ()
+{
+ typeid (float);
+ typeid (std::decimal::decimal32);
+}