https://issues.dlang.org/show_bug.cgi?id=14984
Issue ID: 14984
Summary: Make it illegal (or at least a warning) to modify the
iteration variable in foreach
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
Modifying the index variable in `foreach` is almost always wrong, for example:
https://github.com/D-Programming-Language/dmd/pull/4991
Thus, it should be deprecated and later forbidden. If someone really wants to,
they can use a normal `for` loop.
--