]> gcc.gnu.org Git - gcc.git/commitdiff
d: Fix internal compiler error: in make_import, at d/imports.cc:48 [PR113125]
authorIain Buclaw <ibuclaw@gdcproject.org>
Mon, 12 Feb 2024 15:59:12 +0000 (16:59 +0100)
committerIain Buclaw <ibuclaw@gdcproject.org>
Sun, 3 Mar 2024 00:02:36 +0000 (01:02 +0100)
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)

gcc/d/types.cc
gcc/testsuite/gdc.dg/imports/pr113125.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/pr113125.d [new file with mode: 0644]

index c54049dfb984c815dd8efad8dd61f358db8efcd1..6cf712fabee0a66566b38e84ea7d56a1e6a8be63 100644 (file)
@@ -1103,6 +1103,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 (file)
index 0000000..761e613
--- /dev/null
@@ -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 (file)
index 0000000..cb7300b
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-do compile }
+// { dg-options "-I $srcdir/gdc.dg" }
+module pr113125;
+import imports.pr113125: S113125;
This page took 0.064882 seconds and 5 git commands to generate.