Bug 24542 – actually apply VRP to foreach indices when array is of known length

Status
NEW
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-05-07T12:31:21Z
Last change time
2024-12-13T19:35:10Z
Assigned to
No Owner
Creator
Bolpat
Moved to GitHub: dmd#20452 →

Comments

Comment #0 by qs.il.paperinik — 2024-05-07T12:31:21Z
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.
Comment #1 by nick — 2024-05-07T15:46:45Z
I tried VRP, I don't think it works for array lengths. See issue 13700.
Comment #2 by robert.schadek — 2024-12-13T19:35:10Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20452 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB