Debian Codegraph @

gcc/testsuite/gdc.test/compilable/test14781.d

raw
1 // REQUIRED_ARGS: -o-
2 // PERMUTE_ARGS:
3
4 void impure() {} // impure
5
6 auto fb1(T)() pure
7 {
8 int x;
9 struct A(S)
10 {
11 void fc(T2)()
12 {
13 x = 1; // accessing pure function context is just ok
14 impure(); // impure function call makes fc as impure
15 }
16 this(S a) {}
17 }
18 return A!int();
19 }
20 auto fb2(T)() pure
21 {
22 int x;
23 struct A(S)
24 {
25 void fc(T2)()
26 {
27 impure(); // impure function call makes fc as impure
28 x = 1; // accessing pure function context is just ok
29 }
30 this(S a) {}
31 }
32 return A!int();
33 }
34 void test1()
35 {
36 fb1!int().fc!int();
37 fb2!int().fc!int();
38 }