summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/fail20691.d
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gdc.test/fail_compilation/fail20691.d')
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail20691.d25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail20691.d b/gcc/testsuite/gdc.test/fail_compilation/fail20691.d
new file mode 100644
index 00000000000..7a43232658d
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail20691.d
@@ -0,0 +1,25 @@
+/* REQUIRED_ARGS: -preview=dip1000
+TEST_OUTPUT:
+---
+fail_compilation/fail20691.d(106): Error: cannot take address of `scope` local `sa` in `@safe` function `bar`
+fail_compilation/fail20691.d(106): Error: cannot cast expression `sa` of type `char[][2]` to `char[][]`
+fail_compilation/fail20691.d(107): Error: cannot take address of `scope` local `sa` in `@safe` function `bar`
+fail_compilation/fail20691.d(107): Error: cannot cast expression `sa` of type `char[][2]` to `char[][]`
+fail_compilation/fail20691.d(108): Error: cannot take address of `scope` local `sa` in `@safe` function `bar`
+fail_compilation/fail20691.d(108): Error: cannot cast expression `sa` of type `char[][2]` to `char[][]`
+---
+*/
+
+#line 100
+
+// https://issues.dlang.org/show_bug.cgi?id=20691
+
+void bar() @safe
+{
+ scope char[][2] sa;
+ scope char[][] da = cast(char[][])sa;
+ scope char[][] ca = sa;
+ foo(sa);
+}
+
+void foo(scope char[][] a) @safe;