c++: fix explicit/copy problem [PR109247]
[official-gcc.git] / gcc / testsuite / gdc.dg / torture / gdc191.d
blobf414603cf7bfd7c504a9aaa070942b3197877a02
1 // https://bugzilla.gdcproject.org/show_bug.cgi?id=191
2 // { dg-do run }
3 // { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
5 class C191
7 int count = 0;
9 void testA()
11 class Inner
13 void test()
15 void localFunction()
17 if (++count != 5)
18 testA();
20 localFunction();
23 scope ic = new Inner();
24 ic.test();
27 void testB()
29 class Inner
31 void test()
33 void localFunction()
35 void anotherLocalFunction()
37 if (++count != 10)
38 testB();
40 anotherLocalFunction();
42 localFunction();
45 scope ic = new Inner();
46 ic.test();
49 void testC()
51 class Inner
53 int a = 1;
55 void test()
57 void localFunction()
59 count += a;
60 if (count != 15)
61 testC();
62 assert(a == 1);
64 localFunction();
67 scope ic = new Inner();
68 ic.test();
71 void testD()
73 class Inner
75 void test()
77 int a = 1;
79 void localFunction()
81 count += a;
82 if (count != 20)
83 testD();
84 assert(a == 1);
86 localFunction();
89 scope ic = new Inner();
90 ic.test();
93 void testE()
95 class Inner
97 int a = 1;
99 void test()
101 void localFunction()
103 void anotherLocalFunction()
105 count += a;
106 if (count != 25)
107 testE();
108 assert(a == 1);
111 anotherLocalFunction();
114 localFunction();
117 scope ic = new Inner();
118 ic.test();
121 void testF()
123 class Inner
125 void test()
127 int a = 1;
129 void localFunction()
131 void anotherLocalFunction()
133 count += a;
134 if (count != 30)
135 testF();
136 assert(a == 1);
139 anotherLocalFunction();
142 localFunction();
145 scope ic = new Inner();
146 ic.test();
149 void testG()
151 class Inner
153 void test()
155 void localFunction()
157 int a = 1;
159 void anotherLocalFunction()
161 count += a;
162 if (count != 35)
163 testG();
164 assert(a == 1);
167 anotherLocalFunction();
170 localFunction();
173 scope ic = new Inner();
174 ic.test();
178 void main()
180 scope oc = new C191();
181 oc.testA();
182 assert(oc.count == 5);
184 oc.testB();
185 assert(oc.count == 10);
187 oc.testC();
188 assert(oc.count == 15);
190 oc.testD();
191 assert(oc.count == 20);
193 oc.testE();
194 assert(oc.count == 25);
196 oc.testF();
197 assert(oc.count == 30);
199 oc.testG();
200 assert(oc.count == 35);