[Issue 12782] New: Wrong foreach mutable index implicit conversion error
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed May 21 14:07:29 PDT 2014
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: nobody at puremagic.com
Reporter: bearophile_hugs at eml.cc
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
--
More information about the Digitalmars-d-bugs
mailing list