Debian Codegraph @

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

raw
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail12932.d(11): Error: this array literal causes a GC allocation in `@nogc` function `foo`
5 fail_compilation/fail12932.d(15): Error: this array literal causes a GC allocation in `@nogc` function `foo`
6 ---
7 */
8
9 int* foo() @nogc
10 {
11 foreach (ref e; [1,2,3])
12 {
13 }
14
15 foreach (ref e; [1,2,3])
16 {
17 return &e;
18 }
19 }