gcc/testsuite/gdc.test/fail_compilation/bug8891.d
raw| 1 | /* |
| 2 | TEST_OUTPUT: |
| 3 | --- |
| 4 | fail_compilation/bug8891.d(21): Error: calling non-static function `opCall` requires an instance of type `S` |
| 5 | --- |
| 6 | */ |
| 7 | |
| 8 | struct S |
| 9 | { |
| 10 | int value = 10; |
| 11 | S opCall(int n) // non-static |
| 12 | { |
| 13 | //printf("this.value = %d\n", this.value); // prints garbage! |
| 14 | S s; |
| 15 | s.value = n; |
| 16 | return s; |
| 17 | } |
| 18 | } |
| 19 | void main() |
| 20 | { |
| 21 | S s = 10; |
| 22 | } |