aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2020-11-17 10:48:41 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2020-11-18 10:22:06 +0100
commit27d8c3516b67c0f5a8fe8970d0558ee3b97e8281 (patch)
tree915f1bb7526195a5ea70a21f4779fe17d70efdaf /gcc/testsuite/gdc.test
parentfa9091ad93b2ec6f2580e9f9c7de799fa404cf2e (diff)
downloadgcc-27d8c3516b67c0f5a8fe8970d0558ee3b97e8281.zip
gcc-27d8c3516b67c0f5a8fe8970d0558ee3b97e8281.tar.gz
gcc-27d8c3516b67c0f5a8fe8970d0558ee3b97e8281.tar.bz2
d: Fix a couple of ICEs found in the dmd front-end (PR97842)
- Segmentation fault on incomplete static if. - Segmentation fault resolving typeof() expression when gagging is on. Reviewed-on: https://github.com/dlang/dmd/pull/11971 gcc/d/ChangeLog: PR d/97842 * dmd/MERGE: Merge upstream dmd b6a779e49
Diffstat (limited to 'gcc/testsuite/gdc.test')
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail18970.d37
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/imports/test21164a.d9
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/imports/test21164b.d4
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/imports/test21164c.d10
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/imports/test21164d.d9
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test21164.d13
6 files changed, 82 insertions, 0 deletions
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail18970.d b/gcc/testsuite/gdc.test/fail_compilation/fail18970.d
new file mode 100644
index 0000000..846a578
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail18970.d
@@ -0,0 +1,37 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail18970.d(22): Error: no property `y` for type `fail18970.S`
+fail_compilation/fail18970.d(29): Error: no property `yyy` for type `fail18970.S2`
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=18970
+
+struct S
+{
+ auto opDispatch(string name)(int)
+ {
+ alias T = typeof(x);
+ static assert(!is(T.U));
+ return 0;
+ }
+}
+void f()
+{
+ S().y(1);
+}
+
+struct S2
+{
+ this(int)
+ {
+ this.yyy;
+ }
+
+ auto opDispatch(string name)()
+ {
+ alias T = typeof(x);
+ static if(is(T.U)) {}
+ }
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test21164a.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test21164a.d
new file mode 100644
index 0000000..e5fcd43
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test21164a.d
@@ -0,0 +1,9 @@
+struct D(E)
+{
+ void G() {
+ import imports.test21164d;
+ I;
+ }
+
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test21164b.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test21164b.d
new file mode 100644
index 0000000..ece5476
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test21164b.d
@@ -0,0 +1,4 @@
+import imports.test21164c;
+enum N = O();
+alias Q = R!(N, S);
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test21164c.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test21164c.d
new file mode 100644
index 0000000..21a252f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test21164c.d
@@ -0,0 +1,10 @@
+enum S = 1;
+
+struct O
+{
+}
+
+struct R(O U, int W)
+{
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/test21164d.d b/gcc/testsuite/gdc.test/fail_compilation/imports/test21164d.d
new file mode 100644
index 0000000..08f83ea
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/test21164d.d
@@ -0,0 +1,9 @@
+auto AB()
+{
+static if}
+
+auto I()
+{
+AB;
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test21164.d b/gcc/testsuite/gdc.test/fail_compilation/test21164.d
new file mode 100644
index 0000000..f42c4bc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test21164.d
@@ -0,0 +1,13 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/imports/test21164d.d(3): Error: (expression) expected following `static if`
+fail_compilation/imports/test21164d.d(3): Error: found `}` instead of statement
+fail_compilation/test21164.d(11): Error: template instance `test21164a.D!(R!(O(), 1))` error instantiating
+---
+*/
+import imports.test21164a;
+import imports.test21164b;
+auto GB(D!Q)
+{
+}