gcc/testsuite/gdc.test/fail_compilation/fail224.d
raw| 1 | /* |
| 2 | TEST_OUTPUT: |
| 3 | --- |
| 4 | fail_compilation/fail224.d(22): Error: need `this` of type `A` to access member `x` from static function `f` |
| 5 | --- |
| 6 | */ |
| 7 | |
| 8 | int gi; |
| 9 | |
| 10 | class A |
| 11 | { |
| 12 | int x = 42; |
| 13 | |
| 14 | void am() |
| 15 | { |
| 16 | static void f() |
| 17 | { |
| 18 | class B |
| 19 | { |
| 20 | void bm() |
| 21 | { |
| 22 | gi = x; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | (new B).bm(); |
| 27 | } |
| 28 | |
| 29 | f(); |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | void main() |
| 34 | { |
| 35 | (new A).am(); |
| 36 | } |