| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/fail261.d(20): Error: invalid `foreach` aggregate `range` of type `MyRange` |
| 5 |
fail_compilation/fail261.d(20): `foreach` works with input ranges (implementing `front` and `popFront`), aggregates implementing `opApply`, or the result of an aggregate's `.tupleof` property |
| 6 |
fail_compilation/fail261.d(20): https://dlang.org/phobos/std_range_primitives.html#isInputRange |
| 7 |
--- |
| 8 |
*/ |
| 9 |
|
| 10 |
//import std.stdio; |
| 11 |
|
| 12 |
struct MyRange |
| 13 |
{ |
| 14 |
} |
| 15 |
|
| 16 |
void main() |
| 17 |
{ |
| 18 |
MyRange range; |
| 19 |
|
| 20 |
foreach (r; range) |
| 21 |
{ |
| 22 |
//writefln("%s", r.toString()); |
| 23 |
} |
| 24 |
} |