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

--- Comment #6 from [email protected] ---
(In reply to Lionello Lunesu from comment #5)

> No, the key must be declared const or immutable. Otherwise we need flow
> analysis to ensure the key doesn't get mutated in the scope.

I don't understand what's the problem. What kind of bad things do happen if the
key gets mutated in the scope?

void main() {
    ubyte[256] data;
    foreach (ubyte i, ref x; data) {
        x = i;
        i++; // overflow here
    }
}

--

Reply via email to