| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/fail61.d(25): Error: no property `B` for type `fail61.A.B` |
| 5 |
fail_compilation/fail61.d(16): class `B` defined here |
| 6 |
fail_compilation/fail61.d(26): Error: no property `B` for type `fail61.A.B` |
| 7 |
fail_compilation/fail61.d(16): class `B` defined here |
| 8 |
fail_compilation/fail61.d(35): Error: no property `A2` for type `fail61.B2` |
| 9 |
fail_compilation/fail61.d(30): class `B2` defined here |
| 10 |
fail_compilation/fail61.d(44): Error: calling non-static function `foo` requires an instance of type `B3` |
| 11 |
--- |
| 12 |
*/ |
| 13 |
|
| 14 |
class A |
| 15 |
{ |
| 16 |
class B : A |
| 17 |
{ |
| 18 |
static const int C = 5; |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
void main() |
| 23 |
{ |
| 24 |
int n1 = A.B.C; |
| 25 |
int n2 = A.B.B.C; // Line22 |
| 26 |
int n3 = A.B.B.B.C; // Line23 |
| 27 |
} |
| 28 |
|
| 29 |
class A2 { void foo(){ assert(0);} } |
| 30 |
class B2 : A2 { override void foo(){} } |
| 31 |
class C2 : B2 |
| 32 |
{ |
| 33 |
void bar() |
| 34 |
{ |
| 35 |
B2.A2.foo(); // Line32 |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
class B3 { void foo(){ assert(0); } } |
| 40 |
class C3 |
| 41 |
{ |
| 42 |
void bar() |
| 43 |
{ |
| 44 |
B3.foo(); // Line41 |
| 45 |
} |
| 46 |
} |