https://issues.dlang.org/show_bug.cgi?id=15413

--- Comment #1 from ZombineDev <petar.p.ki...@gmail.com> ---
I wonder if the solution could be as simple* as changing the lowering to:

for ( ; !ir.empty; ir.popFront()) {
    auto v = __r.front;
}

That way foreach will work with truly input-only ranges (such as ones with
@disabled this(this)) and the users could optionally insert a .save call, if
needed, when they're working with forward ranges.

If this is an unacceptable breaking change, we could use the new lowering only
when the postblit is disabled.

* I'm not very familiar the compiler internals, so I have no idea if this would
be actually simple in practice.

--

Reply via email to