public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-895] c++: ICE with bad definition of decimal32 [PR100261]
@ 2021-05-19  0:27 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2021-05-19  0:27 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:01b2864757540d24c4e717a77b40b29369c064b2

commit r12-895-g01b2864757540d24c4e717a77b40b29369c064b2
Author: Jason Merrill <jason@redhat.com>
Date:   Tue May 18 17:15:42 2021 -0400

    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.

Diff:
---
 gcc/cp/rtti.c                       |  2 +-
 gcc/testsuite/g++.dg/dfp/mangle-6.C | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 5a33b83afd0..82eaa286514 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 00000000000..9cfb2a974bb
--- /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);
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-19  0:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19  0:27 [gcc r12-895] c++: ICE with bad definition of decimal32 [PR100261] Jason Merrill

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).