Debian Codegraph @

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

raw
1 /* REQUIRED_ARGS: -preview=dip1000
2 TEST_OUTPUT:
3 ---
4 fail_compilation/test22227.d(12): Error: returning scope variable `foo` is not allowed in a `@safe` function
5 fail_compilation/test22227.d(14): Error: returning scope variable `foo` is not allowed in a `@safe` function
6 ---
7 */
8
9 int[] foo() @safe
10 {
11 if (scope foo = [1])
12 return foo;
13 while (scope foo = [1])
14 return foo;
15 return [];
16 }