gcc/testsuite/gdc.test/fail_compilation/ice12838.d
raw| 1 | /* |
| 2 | TEST_OUTPUT: |
| 3 | --- |
| 4 | fail_compilation/ice12838.d(27): Error: cannot implicitly convert expression `1` of type `int` to `string` |
| 5 | --- |
| 6 | */ |
| 7 | |
| 8 | struct Tuple(T...) |
| 9 | { |
| 10 | T field; |
| 11 | alias field this; |
| 12 | } |
| 13 | |
| 14 | struct Data |
| 15 | { |
| 16 | string a; |
| 17 | } |
| 18 | |
| 19 | template toTuple(T) |
| 20 | { |
| 21 | mixin(`alias toTuple = Tuple!(string);`); |
| 22 | } |
| 23 | |
| 24 | void main() |
| 25 | { |
| 26 | toTuple!Data a; |
| 27 | a[0] = 1; // ICE! |
| 28 | } |