https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108877

ibuclaw at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw at gcc dot gnu.org

--- Comment #1 from ibuclaw at gcc dot gnu.org ---
Immutable is the keyword here. Stub debug symbols are only attached to the main
variant of a type.  I think this would also be reproducible with `immutable
class` and `immutable enum` as well.

Have fix really to commit and backport once I test it.

---

diff --git a/gcc/d/imports.cc b/gcc/d/imports.cc
index 3b46d1b7560..2efef4ed54f 100644
--- a/gcc/d/imports.cc
+++ b/gcc/d/imports.cc
@@ -106,12 +106,16 @@ public:
     tree type = build_ctype (d->type);
     /* Not all kinds of D enums create a TYPE_DECL.  */
     if (TREE_CODE (type) == ENUMERAL_TYPE)
-      this->result_ = this->make_import (TYPE_STUB_DECL (type));
+      {
+       type = TYPE_MAIN_VARIANT (type);
+       this->result_ = this->make_import (TYPE_STUB_DECL (type));
+      }
   }

   void visit (AggregateDeclaration *d) final override
   {
     tree type = build_ctype (d->type);
+    type = TYPE_MAIN_VARIANT (type);
     this->result_ = this->make_import (TYPE_STUB_DECL (type));
   }

@@ -119,6 +123,7 @@ public:
   {
     /* Want the RECORD_TYPE, not POINTER_TYPE.  */
     tree type = TREE_TYPE (build_ctype (d->type));
+    type = TYPE_MAIN_VARIANT (type);
     this->result_ = this->make_import (TYPE_STUB_DECL (type));
   }

Reply via email to