summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/compilable/issue20705.d
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gdc.test/compilable/issue20705.d')
-rw-r--r--gcc/testsuite/gdc.test/compilable/issue20705.d16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/gdc.test/compilable/issue20705.d b/gcc/testsuite/gdc.test/compilable/issue20705.d
new file mode 100644
index 00000000000..76a364e129b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/issue20705.d
@@ -0,0 +1,16 @@
+// REQUIRED_ARGS: -preview=rvaluerefparam
+struct Foo
+{
+ int[] a;
+}
+
+void bar (T) (const ref T arg) {}
+T foo (T) (ref T arg) { return arg; }
+void goo()(ref long x) { x = 1; }
+void main ()
+{
+ bar(Foo([42]));
+ auto x = foo(Foo([42]));
+ int y;
+ static assert(!__traits(compiles, goo(y)));
+}