https://issues.dlang.org/show_bug.cgi?id=24450
Issue ID: 24450
Summary: apply VRP to foreach indices when array is of known
length
Product: D
Version: D2
Hardware: x86_64
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
This:
foreach (int i, color; [red, green, blue])
img.fillCircle(50 + i * 20, 30 + i * 10, 20 + i * 5, color);
should not give an error about implicit conversion of 64 bit size_t to int,
because the array's length is known to fit in an int.
https://github.com/dlang/dmd/pull/8941#issuecomment-496306412
--