Debian Codegraph @

gcc/testsuite/gdc.test/fail_compilation/fail20084.d

raw
1 /* REQUIRED_ARGS: -preview=dip1000
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail20084.d(109): Error: escaping a reference to parameter `v` by returning `v.front()` is not allowed in a `@safe` function
5 ---
6 */
7
8 #line 100
9
10 // https://issues.dlang.org/show_bug.cgi?id=20084
11
12 struct W() {
13 int value;
14 @safe ref int front() return { return value; }
15 }
16
17 @safe ref int get(W!() v) {
18 return v.front;
19 }