Debian Codegraph @

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

raw
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail59.d(50): Error: cannot construct nested class `C2` because no implicit `this` reference to outer class `C1` is available
5 ---
6 */
7
8 class C1
9 {
10 int c1;
11
12 this()
13 {
14 c1 = 2;
15 }
16
17 class C2
18 {
19 class C3
20 {
21 int c3;
22
23 this(int n)
24 {
25 c3 = n + c1 + c2;
26 }
27 }
28
29 int c2;
30
31 C3 foo()
32 {
33 return new C3(8);
34 }
35
36 this(int k)
37 {
38 c2 = k + 7;
39 }
40 }
41
42 C2 bar()
43 {
44 return new C2(17);
45 }
46 }
47
48 void main()
49 {
50 C1.C2 q = new C1.C2(3);
51 }