summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/test22818.d
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gdc.test/fail_compilation/test22818.d')
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/test22818.d21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test22818.d b/gcc/testsuite/gdc.test/fail_compilation/test22818.d
new file mode 100644
index 00000000000..ae96b3bc109
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/test22818.d
@@ -0,0 +1,21 @@
+/* REQUIRED_ARGS: -preview=dip1000
+ * TEST_OUTPUT:
+---
+fail_compilation/test22818.d(104): Error: scope variable `c` may not be returned
+---
+*/
+
+// issues.dlang.org/show_bug.cgi?id=22818
+
+#line 100
+
+@safe:
+ref int g(C c ...)
+{
+ return c.x;
+}
+
+class C
+{
+ int x;
+}