Debian Codegraph @

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

raw
1 /* REQUIRED_ARGS: -preview=dip1000
2 * TEST_OUTPUT:
3 ---
4 fail_compilation/fail19881.d(13): Error: assigning address of local variable `local` to return scope `input` is not allowed in a `@safe` function
5 fail_compilation/fail19881.d(13): Error: assigning address of variable `local` to `input` with longer lifetime is not allowed in a `@safe` function
6 ---
7 */
8
9 // https://issues.dlang.org/show_bug.cgi?id=19881
10
11 @safe int* test(return scope int* input) {
12 int local = 42;
13 input = &local;
14
15 return input;
16 }