aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.dg
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2023-02-27 20:46:18 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2023-03-03 01:25:32 +0100
commitce1cea3e22f58bbddde017f8a92e59bae8892339 (patch)
tree0e721708af289067b967cc6c8d00ab3817594478 /gcc/testsuite/gdc.dg
parent33a7811896a6c8e6fa71e385dbdf5013d833a116 (diff)
downloadgcc-ce1cea3e22f58bbddde017f8a92e59bae8892339.zip
gcc-ce1cea3e22f58bbddde017f8a92e59bae8892339.tar.gz
gcc-ce1cea3e22f58bbddde017f8a92e59bae8892339.tar.bz2
d: Fix ICE on explicit immutable struct import [PR108877]
Const and immutable types are built as variants of the type they are derived from, and TYPE_STUB_DECL is not set for these variants. PR d/108877 gcc/d/ChangeLog: * imports.cc (ImportVisitor::visit (EnumDeclaration *)): Call make_import on TYPE_MAIN_VARIANT. (ImportVisitor::visit (AggregateDeclaration *)): Likewise. (ImportVisitor::visit (ClassDeclaration *)): Likewise. gcc/testsuite/ChangeLog: * gdc.dg/imports/pr108877a.d: New test. * gdc.dg/pr108877.d: New test.
Diffstat (limited to 'gcc/testsuite/gdc.dg')
-rw-r--r--gcc/testsuite/gdc.dg/imports/pr108877a.d6
-rw-r--r--gcc/testsuite/gdc.dg/pr108877.d9
2 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/gdc.dg/imports/pr108877a.d b/gcc/testsuite/gdc.dg/imports/pr108877a.d
new file mode 100644
index 0000000..a23c78d
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/imports/pr108877a.d
@@ -0,0 +1,6 @@
+immutable struct ImmutableS { }
+const struct ConstS { }
+immutable class ImmutableC { }
+const class ConstC { }
+immutable enum ImmutableE { _ }
+const enum ConstE { _ }
diff --git a/gcc/testsuite/gdc.dg/pr108877.d b/gcc/testsuite/gdc.dg/pr108877.d
new file mode 100644
index 0000000..710551f
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr108877.d
@@ -0,0 +1,9 @@
+// { dg-options "-I $srcdir/gdc.dg" }
+// { dg-do compile }
+import imports.pr108877a :
+ ImmutableS,
+ ConstS,
+ ImmutableC,
+ ConstC,
+ ImmutableE,
+ ConstE;