digitalmars.D.bugs - [Issue 12782] New: Wrong foreach mutable index implicit conversion
- via Digitalmars-d-bugs (27/27) May 21 2014 https://issues.dlang.org/show_bug.cgi?id=12782
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 puremagic.com Reporter: bearophile_hugs 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 --
May 21 2014