Debian Codegraph @

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

raw
1 /* REQUIRED_ARGS: -preview=dip1000
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail22138.d(107): Error: returning scope variable `e` is not allowed in a `@safe` function
5 ---
6 */
7
8 // https://issues.dlang.org/show_bug.cgi?id=22138
9
10 #line 100
11
12 @safe
13 int* test()
14 {
15 int*[] a;
16 foreach (scope e; a)
17 {
18 return e;
19 }
20 return null;
21 }