[Issue 24542] New: actually apply VRP to foreach indices when array is of known length
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue May 7 12:31:21 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=24542
Issue ID: 24542
Summary: actually apply VRP to foreach indices when array is of
known length
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: qs.il.paperinik at gmail.com
Follow-up to Issue 24450
```d
foreach (int i, int x; cond() ? [1,2,3] : [1,2])
{ }
```
should likewise not be an error. The length is not known, but is bounded the
same way `cond() ? 3 : 2` is bounded, and VRP detects that.
--
More information about the Digitalmars-d-bugs
mailing list