https://issues.dlang.org/show_bug.cgi?id=12782
Issue ID: 12782
Summary: Wrong foreach mutable index implicit conversion error
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: rejects-valid
Severity: enhancement
Priority: P1
Component: DMD
Assignee: [email protected]
Reporter: [email protected]
Apparently the bug fix of Issue 9570 is not able to handle this case, so this
is a new enhancement request. I think this code should be accepted:
void main() {
ubyte[256] data;
foreach (ubyte i, ref x; data) {
i += 200;
i = 200;
x = i;
}
}
With dmd 2.066alpha it gives:
temp.d(3,5): Error: index type 'ubyte' cannot cover index range 0..256
--