1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail100.d(24): Error: cannot implicitly convert expression `f` of type `Class[]` to `I[]`
5 ---
6 */
7 
8 // Issue 85 - Array of classes doesn't function as array of interfaces
9 
10 interface I
11 {
12     I[] foo();
13     uint x();
14 }
15 
16 class Class : I
17 {
foo()18     I[] foo()
19     {
20         // changing this to I[] f = new Class[1] fixes the bug
21         Class[] f = new Class[1];
22         //I[] f = new Class[1];
23         f[0] = new Class;
24         return f;
25     }
26 
x()27     uint x()
28     {
29         return 0;
30     }
31 }
32 
main()33 void main()
34 {
35     Class c = new Class();
36     assert(c.x == 0);
37     assert(c.foo[0].x == 0);
38 }
39