| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/diag15209.d(18): Error: accessing non-static variable `x` requires an instance of `C1` |
| 5 |
fail_compilation/diag15209.d(21): Error: accessing non-static variable `x` requires an instance of `S2` |
| 6 |
--- |
| 7 |
*/ |
| 8 |
|
| 9 |
class C1 { int x; } |
| 10 |
struct S1 { alias y = C1.x; } |
| 11 |
|
| 12 |
struct S2 { int x; } |
| 13 |
class C2 { alias y = S2.x; } |
| 14 |
|
| 15 |
void main() |
| 16 |
{ |
| 17 |
S1 s1; |
| 18 |
s1.y = 10; // invalid field variable access |
| 19 |
|
| 20 |
auto c2 = new C2(); |
| 21 |
c2.y = 10; // invalid field variable access |
| 22 |
} |