gcc/testsuite/gdc.test/fail_compilation/ice15332.d
raw| 1 | /* |
| 2 | TEST_OUTPUT: |
| 3 | --- |
| 4 | fail_compilation/ice15332.d(16): Error: calling non-static function `fun` requires an instance of type `C` |
| 5 | fail_compilation/ice15332.d(17): Error: accessing non-static variable `var` requires an instance of `C` |
| 6 | --- |
| 7 | */ |
| 8 | |
| 9 | class C |
| 10 | { |
| 11 | int fun() { return 5; } |
| 12 | int var; |
| 13 | |
| 14 | void test() |
| 15 | { |
| 16 | int a1 = function() { return fun; }(); |
| 17 | int a2 = function() { return var; }(); |
| 18 | } |
| 19 | } |