gcc/testsuite/gdc.test/fail_compilation/fail15.d
raw| 1 | /* |
| 2 | TEST_OUTPUT: |
| 3 | --- |
| 4 | fail_compilation/fail15.d(24): Error: cannot use `[]` operator on expression of type `void` |
| 5 | --- |
| 6 | */ |
| 7 | /* |
| 8 | Segfault on DMD 0.095 |
| 9 | https://www.digitalmars.com/d/archives/digitalmars/D/bugs/926.html |
| 10 | */ |
| 11 | module test; |
| 12 | |
| 13 | template Test() |
| 14 | { |
| 15 | bool opIndex(bool x) |
| 16 | { |
| 17 | return !x; |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | void main() |
| 22 | { |
| 23 | mixin Test!() xs; |
| 24 | bool x = xs[false]; |
| 25 | } |