| 1 |
// PERMUTE_ARGS: -w -dw -de -d |
| 2 |
|
| 3 |
/******************************************/ |
| 4 |
// https://issues.dlang.org/show_bug.cgi?id=6652 |
| 5 |
|
| 6 |
/* |
| 7 |
TEST_OUTPUT: |
| 8 |
--- |
| 9 |
fail_compilation/fail6652.d(20): Error: cannot modify `const` expression `i` |
| 10 |
fail_compilation/fail6652.d(25): Error: cannot modify `const` expression `i` |
| 11 |
fail_compilation/fail6652.d(30): Error: cannot modify `const` expression `i` |
| 12 |
fail_compilation/fail6652.d(35): Error: cannot modify `const` expression `i` |
| 13 |
--- |
| 14 |
*/ |
| 15 |
|
| 16 |
void main() |
| 17 |
{ |
| 18 |
foreach (const i; 0..2) |
| 19 |
{ |
| 20 |
++i; |
| 21 |
} |
| 22 |
|
| 23 |
foreach (ref const i; 0..2) |
| 24 |
{ |
| 25 |
++i; |
| 26 |
} |
| 27 |
|
| 28 |
foreach (const i, e; [1,2,3,4,5]) |
| 29 |
{ |
| 30 |
++i; |
| 31 |
} |
| 32 |
|
| 33 |
foreach (ref const i, e; [1,2,3,4,5]) |
| 34 |
{ |
| 35 |
++i; |
| 36 |
} |
| 37 |
} |