]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gdc.test/fail_compilation/fail94.d
Add D front-end, libphobos library, and D2 testsuite.
[thirdparty/gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail94.d
1 interface I
2 {
3 int foo();
4 }
5
6 class IA : I
7 {
8 int foo() { return 1; }
9 }
10
11 class A
12 {
13 I i;
14
15 I clone() { return i; }
16 }
17
18 class B : A
19 {
20 IA ia;
21
22 IA clone()
23 out (result)
24 {
25 printf("B.clone()\n");
26 }
27 body { return ia; }
28 }
29
30 void main()
31 {
32 IA ia = new IA;
33 assert(ia.foo() == 1);
34
35 I i = ia;
36 assert(i.foo() == 1);
37
38 A a = new A;
39 a.i = i;
40 assert(a.clone().foo() == 1);
41
42 B b = new B;
43 b.ia = ia;
44 assert(b.clone().foo() == 1);
45
46 a = b;
47 assert(a.clone().foo() == 1);
48
49 bar(&b.clone);
50 }
51
52
53 void bar(IA delegate() dg)
54 {
55 }
56