gcc/testsuite/gdc.test/fail_compilation/ice12902.d
raw| 1 | /* |
| 2 | TEST_OUTPUT: |
| 3 | --- |
| 4 | fail_compilation/ice12902.d(20): Error: variable `ice12902.main.$` - type `void` is inferred from initializer `s.opDollar()`, and variables cannot be of type `void` |
| 5 | fail_compilation/ice12902.d(20): Error: expression `s.opDollar()` is `void` and has no value |
| 6 | --- |
| 7 | */ |
| 8 | |
| 9 | struct S |
| 10 | { |
| 11 | void opDollar() { } |
| 12 | void opIndex() { } |
| 13 | void opIndexAssign() { } |
| 14 | void opSliceAssign() { } |
| 15 | } |
| 16 | |
| 17 | void main() |
| 18 | { |
| 19 | S s; |
| 20 | s[] = s[$]; |
| 21 | } |