digitalmars.D.bugs - [Issue 22836] New: [Reg 2.070/2.093] foreach using ubyte index over
- d-bugmail puremagic.com (32/33) Mar 02 2022 https://issues.dlang.org/show_bug.cgi?id=22836
https://issues.dlang.org/show_bug.cgi?id=22836 Issue ID: 22836 Summary: [Reg 2.070/2.093] foreach using ubyte index over static array of length 256 or ushort index over static array of length 65536 does not execute the foreach body Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: regression Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: n8sh.secondary hotmail.com Demonstration: ``` void main() { ubyte[256] array; foreach (const ubyte i, ref a; array) { a = i; } assert(array[1] != 0); // Fails! } ``` The above runs and the assertion passes in v2.069.2.From v2.070.2 through v2.092.1 the above fails to compile with the errormessage "index type `const(ubyte)` cannot cover index range 0..256". In v2.093.1 the above runs but the assertion fails. --
Mar 02 2022