https://issues.dlang.org/show_bug.cgi?id=12685
Issue ID: 12685
Summary: Refused foreach index type to span the whole range of
the type
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Keywords: diagnostic, rejects-valid
Severity: normal
Priority: P1
Component: DMD
Assignee: [email protected]
Reporter: [email protected]
void main() {
ubyte[2 ^^ 8] data1;
foreach (ubyte i, x; data1) {}
ushort[2 ^^ 16] data2;
foreach (ushort i, x; data2) {}
}
DMD 2.066alpha gives false error messages:
temp.d(3,5): Error: index type 'ubyte' cannot cover index range 0..256
temp.d(5,5): Error: index type 'ushort' cannot cover index range 0..65536
--