MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / attributediagnostic_nogc.d
blobe3dbee899fc16e7edb7993cd35cc1ae37985d46e
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/attributediagnostic_nogc.d(21): Error: `@nogc` function `attributediagnostic_nogc.layer2` cannot call non-@nogc function `attributediagnostic_nogc.layer1`
5 fail_compilation/attributediagnostic_nogc.d(22): which calls `attributediagnostic_nogc.layer0`
6 fail_compilation/attributediagnostic_nogc.d(23): which calls `attributediagnostic_nogc.gc`
7 fail_compilation/attributediagnostic_nogc.d(27): which wasn't inferred `@nogc` because of:
8 fail_compilation/attributediagnostic_nogc.d(27): `asm` statement in function `attributediagnostic_nogc.gc` is assumed to use the GC - mark it with `@nogc` if it does not
9 fail_compilation/attributediagnostic_nogc.d(43): Error: `@nogc` function `D main` cannot call non-@nogc function `attributediagnostic_nogc.gc1`
10 fail_compilation/attributediagnostic_nogc.d(32): which wasn't inferred `@nogc` because of:
11 fail_compilation/attributediagnostic_nogc.d(32): cannot use `new` in `@nogc` function `attributediagnostic_nogc.gc1`
12 fail_compilation/attributediagnostic_nogc.d(44): Error: `@nogc` function `D main` cannot call non-@nogc function `attributediagnostic_nogc.gc2`
13 fail_compilation/attributediagnostic_nogc.d(38): which wasn't inferred `@nogc` because of:
14 fail_compilation/attributediagnostic_nogc.d(38): `@nogc` function `attributediagnostic_nogc.gc2` cannot call non-@nogc `fgc`
15 fail_compilation/attributediagnostic_nogc.d(45): Error: `@nogc` function `D main` cannot call non-@nogc function `attributediagnostic_nogc.gcClosure`
16 fail_compilation/attributediagnostic_nogc.d(48): which wasn't inferred `@nogc` because of:
17 fail_compilation/attributediagnostic_nogc.d(48): function `attributediagnostic_nogc.gcClosure` is `@nogc` yet allocates closure for `gcClosure()` with the GC
18 ---
20 #line 18
21 // Issue 17374 - Improve inferred attribute error message
22 // https://issues.dlang.org/show_bug.cgi?id=17374
24 auto layer2() @nogc { layer1(); }
25 auto layer1() { layer0(); }
26 auto layer0() { gc(); }
28 auto gc()
30 asm {}
33 auto gc1()
35 int* x = new int;
38 auto fgc = function void() {new int[10];};
39 auto gc2()
41 fgc();
44 void main() @nogc
46 gc1();
47 gc2();
48 gcClosure();
51 auto gcClosure()
53 int x;
54 int bar() { return x; }
55 return &bar;