Debian Codegraph @

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

raw
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail284.d(19): Error: `pure` function `fail284.foo` cannot call impure function pointer `a`
5 ---
6 */
7
8 static int nasty;
9
10 int impure_evil_function(int x)
11 {
12 nasty++;
13 return nasty;
14 }
15
16 pure int foo(int x)
17 {
18 int function(int) a = &impure_evil_function;
19 return a(x);
20 }