summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2024-02-12 16:59:12 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2024-03-03 01:04:49 +0100
commit3c0c18799eff99221d2eaae3de6fca6da14269dd (patch)
tree40c324234655ae397fb9e38198cbe5a4e16bef09
parent65fe26c4cb39f3867fe7f396167386a82b7ed3c4 (diff)
d: Fix internal compiler error: in make_import, at d/imports.cc:48 [PR113125]
The cause of the ICE was that TYPE_DECLs were only being generated for structs with members, not opaque structs. PR d/113125 gcc/d/ChangeLog: * types.cc (TypeVisitor::visit (TypeStruct *)): Generate TYPE_DECL and apply UDAs to opaque struct declarations. gcc/testsuite/ChangeLog: * gdc.dg/imports/pr113125.d: New test. * gdc.dg/pr113125.d: New test. (cherry picked from commit b0efb1c35724e3332ee5993976efb98200c1a154)
-rw-r--r--gcc/d/types.cc5
-rw-r--r--gcc/testsuite/gdc.dg/imports/pr113125.d2
-rw-r--r--gcc/testsuite/gdc.dg/pr113125.d4
3 files changed, 11 insertions, 0 deletions
diff --git a/gcc/d/types.cc b/gcc/d/types.cc
index 3b121f5b042..84995a6e681 100644
--- a/gcc/d/types.cc
+++ b/gcc/d/types.cc
@@ -1008,6 +1008,11 @@ public:
apply_user_attributes (t->sym, t->ctype);
finish_aggregate_type (structsize, alignsize, t->ctype);
}
+ else
+ {
+ build_type_decl (t->ctype, t->sym);
+ apply_user_attributes (t->sym, t->ctype);
+ }
TYPE_CONTEXT (t->ctype) = d_decl_context (t->sym);
build_type_decl (t->ctype, t->sym);
diff --git a/gcc/testsuite/gdc.dg/imports/pr113125.d b/gcc/testsuite/gdc.dg/imports/pr113125.d
new file mode 100644
index 00000000000..761e613b055
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/imports/pr113125.d
@@ -0,0 +1,2 @@
+module imports.pr113125;
+struct S113125;
diff --git a/gcc/testsuite/gdc.dg/pr113125.d b/gcc/testsuite/gdc.dg/pr113125.d
new file mode 100644
index 00000000000..cb7300baa1a
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr113125.d
@@ -0,0 +1,4 @@
+// { dg-do compile }
+// { dg-options "-I $srcdir/gdc.dg" }
+module pr113125;
+import imports.pr113125: S113125;