| 1 |
// https://issues.dlang.org/show_bug.cgi?id=13577 |
| 2 |
|
| 3 |
/* |
| 4 |
TEST_OUTPUT: |
| 5 |
--- |
| 6 |
fail_compilation/fail13577.d(27): Error: cannot implicitly convert tuple element of type `int[]` to variable `x` of type `immutable(int[])` |
| 7 |
--- |
| 8 |
*/ |
| 9 |
|
| 10 |
struct Tuple(Types...) |
| 11 |
{ |
| 12 |
Types items; |
| 13 |
alias items this; |
| 14 |
} |
| 15 |
|
| 16 |
struct Range(T) |
| 17 |
{ |
| 18 |
T[] arr; |
| 19 |
alias ElemType = Tuple!(int, T); |
| 20 |
ElemType front() { return typeof(return)(0, arr[0]); } |
| 21 |
bool empty() { return false; } |
| 22 |
void popFront() {} |
| 23 |
} |
| 24 |
|
| 25 |
void main() |
| 26 |
{ |
| 27 |
foreach (immutable i, immutable x; Range!(int[])()) {} // Error |
| 28 |
} |