Debian Codegraph @

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

raw
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/diag9620.d(19): Error: `pure` function `diag9620.main.bar` cannot call impure function `diag9620.foo1`
5 fail_compilation/diag9620.d(20): Error: `pure` function `diag9620.main.bar` cannot call impure function `diag9620.foo2!().foo2`
6 fail_compilation/diag9620.d(13): and accessing mutable static data `x` makes it fail to infer `pure`
7 ---
8 */
9
10 int x;
11
12 void foo1() { x = 3; }
13 void foo2()() { x = 3; }
14
15 void main() pure
16 {
17 void bar()
18 {
19 foo1();
20 foo2();
21 }
22 }