| 1 |
// https://issues.dlang.org/show_bug.cgi?id=5435 |
| 2 |
/* |
| 3 |
TEST_OUTPUT: |
| 4 |
--- |
| 5 |
Enum5435.A |
| 6 |
Enum5435.B |
| 7 |
Enum5435.C |
| 8 |
fail_compilation/fail5435.d(38): Error: cannot implicitly convert expression `"foo"` of type `string` to `Enum5435` |
| 9 |
fail_compilation/fail5435.d(38): while evaluating `pragma(msg, foo)` |
| 10 |
fail_compilation/fail5435.d(38): Error: cannot implicitly convert expression `3.0` of type `double` to `Enum5435` |
| 11 |
fail_compilation/fail5435.d(38): while evaluating `pragma(msg, foo)` |
| 12 |
fail_compilation/fail5435.d(39): Error: cannot implicitly convert expression `Enum5435.A` of type `Enum5435` to `string` |
| 13 |
fail_compilation/fail5435.d(39): while evaluating `pragma(msg, foo)` |
| 14 |
fail_compilation/fail5435.d(39): Error: cannot implicitly convert expression `Enum5435.B` of type `Enum5435` to `string` |
| 15 |
fail_compilation/fail5435.d(39): while evaluating `pragma(msg, foo)` |
| 16 |
fail_compilation/fail5435.d(39): Error: cannot implicitly convert expression `Enum5435.C` of type `Enum5435` to `string` |
| 17 |
fail_compilation/fail5435.d(39): while evaluating `pragma(msg, foo)` |
| 18 |
foo |
| 19 |
fail_compilation/fail5435.d(39): Error: cannot implicitly convert expression `3.0` of type `double` to `string` |
| 20 |
fail_compilation/fail5435.d(39): while evaluating `pragma(msg, foo)` |
| 21 |
0 |
| 22 |
1 |
| 23 |
2 |
| 24 |
fail_compilation/fail5435.d(40): Error: cannot implicitly convert expression `"foo"` of type `string` to `int` |
| 25 |
fail_compilation/fail5435.d(40): while evaluating `pragma(msg, foo)` |
| 26 |
fail_compilation/fail5435.d(40): Error: cannot implicitly convert expression `3.0` of type `double` to `int` |
| 27 |
fail_compilation/fail5435.d(40): while evaluating `pragma(msg, foo)` |
| 28 |
--- |
| 29 |
*/ |
| 30 |
|
| 31 |
template Tuple5435(E...) { alias E Tuple5435; } |
| 32 |
enum Enum5435 { A, B, C }; |
| 33 |
|
| 34 |
void main() |
| 35 |
{ |
| 36 |
alias Tuple5435!(Enum5435.A, Enum5435.B, Enum5435.C, "foo", 3.0) tup; |
| 37 |
|
| 38 |
foreach (Enum5435 foo; tup) pragma(msg, foo); |
| 39 |
foreach ( string foo; tup) pragma(msg, foo); |
| 40 |
foreach ( int foo; tup) pragma(msg, foo); |
| 41 |
} |