aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gcc.gnu.org>2019-06-16 22:50:16 +0000
committerIain Buclaw <ibuclaw@gcc.gnu.org>2019-06-16 22:50:16 +0000
commit956fba45850b476de63844b351a7cbad13a0ae46 (patch)
treeeb5cdd6e7f9857dc9c52767d850df73fb6425beb /gcc/testsuite/gdc.test
parentbbd54be5a73dc82548f7fc3d17542caed679fab8 (diff)
downloadgcc-956fba45850b476de63844b351a7cbad13a0ae46.zip
gcc-956fba45850b476de63844b351a7cbad13a0ae46.tar.gz
gcc-956fba45850b476de63844b351a7cbad13a0ae46.tar.bz2
re PR d/90603 (ICE in functionParameters, at d/dmd/expression.c:1553)
PR d/90603 d/dmd: Merge upstream dmd 792f0fdf2 Fixes segmentation fault in functionParameters, and other related semantic bugs in forward or recursively referenced declarations. Reviewed-on: https://github.com/dlang/dmd/pull/10046 From-SVN: r272366
Diffstat (limited to 'gcc/testsuite/gdc.test')
-rw-r--r--gcc/testsuite/gdc.test/compilable/imports/test16214b.d10
-rw-r--r--gcc/testsuite/gdc.test/compilable/test16214a.d7
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/b15875.d10
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/b17285.d15
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/b19691.d20
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/b19691e.d24
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/b19717.d16
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/b19717a.d14
8 files changed, 116 insertions, 0 deletions
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test16214b.d b/gcc/testsuite/gdc.test/compilable/imports/test16214b.d
new file mode 100644
index 0000000..e2036fc
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test16214b.d
@@ -0,0 +1,10 @@
+module test16214b;
+import test16214a;
+
+struct Appender() { int[] arr; }
+struct Tuple() { alias A = Appender!(); }
+
+class EventLoop
+{
+ auto f() { auto x = [Tuple!().init]; }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test16214a.d b/gcc/testsuite/gdc.test/compilable/test16214a.d
new file mode 100644
index 0000000..2ea64d9
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test16214a.d
@@ -0,0 +1,7 @@
+// EXTRA_SOURCES: imports/test16214b.d
+// REQUIRED_ARGS: -Icompilable/imports
+
+module test16214a;
+import test16214b;
+
+class LibasyncEventLoop : EventLoop {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/b15875.d b/gcc/testsuite/gdc.test/fail_compilation/b15875.d
new file mode 100644
index 0000000..daa79b7
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/b15875.d
@@ -0,0 +1,10 @@
+/* TEST_OUTPUT:
+---
+fail_compilation/b15875.d(9): Error: circular reference to variable `a`
+fail_compilation/b15875.d(10): Error: circular reference to `b15875.f`
+---
+*/
+// https://issues.dlang.org/show_bug.cgi?id=15875
+// https://issues.dlang.org/show_bug.cgi?id=17290
+d o(int[a]a)(){}
+f.T f(){}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/b17285.d b/gcc/testsuite/gdc.test/fail_compilation/b17285.d
new file mode 100644
index 0000000..7b79cf0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/b17285.d
@@ -0,0 +1,15 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/b17285.d(14): Error: type `ONE` has no value
+fail_compilation/b17285.d(14): Error: type `TWO` has no value
+fail_compilation/b17285.d(14): Error: cannot implicitly convert expression `ONE` of type `b17285.ONE` to `int`
+---
+*/
+
+class ONE {}
+enum TWO;
+
+void foo() {
+ foreach(key; [ONE, TWO, 1]) {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/b19691.d b/gcc/testsuite/gdc.test/fail_compilation/b19691.d
new file mode 100644
index 0000000..8663512
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/b19691.d
@@ -0,0 +1,20 @@
+// REQUIRED_ARGS: -de
+/* TEST_OUTPUT:
+---
+fail_compilation/b19691.d(13): Error: forward reference to template `this`
+fail_compilation/b19691.d(19): Deprecation: constructor `b19691.S2.this` all parameters have default arguments, but structs cannot have default constructors.
+---
+*/
+// https://issues.dlang.org/show_bug.cgi?id=19691
+module b19691;
+
+struct S1 {
+ this(T...)(T) {
+ S2("");
+ }
+}
+
+struct S2 {
+ this(string) {}
+ this(S1 s = null) {}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/b19691e.d b/gcc/testsuite/gdc.test/fail_compilation/b19691e.d
new file mode 100644
index 0000000..21d0e90
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/b19691e.d
@@ -0,0 +1,24 @@
+// REQUIRED_ARGS: -de
+/* TEST_OUTPUT:
+---
+fail_compilation/b19691e.d(17): Error: forward reference to template `this`
+fail_compilation/b19691e.d(17): Error: constructor `b19691e.S2.this(S1 s = "")` is not callable using argument types `(string)`
+fail_compilation/b19691e.d(17): Error: forward reference to template `this`
+fail_compilation/b19691e.d(23): Deprecation: constructor `b19691e.S2.this` all parameters have default arguments, but structs cannot have default constructors.
+---
+*/
+// https://issues.dlang.org/show_bug.cgi?id=19691
+module b19691e;
+
+struct S1
+{
+ this(T)(T)
+ {
+ S2("");
+ }
+}
+
+struct S2
+{
+ this(S1 s = ""){}
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/b19717.d b/gcc/testsuite/gdc.test/fail_compilation/b19717.d
new file mode 100644
index 0000000..6a48b88
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/b19717.d
@@ -0,0 +1,16 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/b19717.d(16): Error: undefined identifier `Foo`, did you mean function `foo`?
+fail_compilation/b19717.d(13): Error: forward reference to template `foo`
+fail_compilation/b19717.d(13): Error: forward reference to inferred return type of function call `foo()`
+---
+*/
+
+enum bar = __traits(getMember, mixin(__MODULE__), "foo");
+
+auto foo() {
+ return foo();
+}
+
+void foo(Foo) {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/b19717a.d b/gcc/testsuite/gdc.test/fail_compilation/b19717a.d
new file mode 100644
index 0000000..79a9de0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/b19717a.d
@@ -0,0 +1,14 @@
+// REQUIRED_ARGS: -de
+/* TEST_OUTPUT:
+---
+fail_compilation/b19717a.d(14): Error: forward reference to template `a`
+fail_compilation/b19717a.d(14): Error: forward reference to template `a`
+fail_compilation/b19717a.d(14): Error: none of the overloads of `a` are callable using argument types `()`, candidates are:
+fail_compilation/b19717a.d(13): `b19717a.a(int b)`
+fail_compilation/b19717a.d(14): `b19717a.a(int b = a)`
+---
+*/
+module b19717a;
+
+auto a(int b) {}
+auto a(int b = a) {}