Debian Codegraph @

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

raw
1 /* REQUIRED_ARGS: -preview=dip1000
2 * TEST_OUTPUT:
3 ---
4 fail_compilation/fail17927.d(13): Error: scope parameter `this` may not be returned
5 fail_compilation/fail17927.d(15): Error: scope parameter `this` may not be returned
6 fail_compilation/fail17927.d(21): Error: scope parameter `ptr` may not be returned
7 fail_compilation/fail17927.d(23): Error: scope parameter `ptr` may not be returned
8 ---
9 */
10 // https://issues.dlang.org/show_bug.cgi?id=17927
11
12 struct String {
13 const(char)* mem1() const scope @safe { return ptr; }
14 // https://issues.dlang.org/show_bug.cgi?id=22027
15 inout(char)* mem2() inout scope @safe { return ptr; }
16
17 char* ptr;
18 }
19
20
21 const(char)* foo1(scope const(char)* ptr) @safe { return ptr; }
22
23 inout(char)* foo2(scope inout(char)* ptr) @safe { return ptr; }