diff options
Diffstat (limited to 'gcc/testsuite/gdc.test/fail_compilation/fail20084.d')
-rw-r--r-- | gcc/testsuite/gdc.test/fail_compilation/fail20084.d | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail20084.d b/gcc/testsuite/gdc.test/fail_compilation/fail20084.d new file mode 100644 index 00000000000..dcc73a9c5fc --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail20084.d @@ -0,0 +1,19 @@ +/* REQUIRED_ARGS: -preview=dip1000 +TEST_OUTPUT: +--- +fail_compilation/fail20084.d(109): Error: returning `v.front()` escapes a reference to local variable `v` +--- +*/ + +#line 100 + +// https://issues.dlang.org/show_bug.cgi?id=20084 + +struct W() { + int value; + @safe ref int front() return { return value; } +} + +@safe ref int get(W!() v) { + return v.front; +} |