Issue 24450 - apply VRP to foreach indices when array is of known length
Summary: apply VRP to foreach indices when array is of known length
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 All
: P1 enhancement
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2024-03-24 16:41 UTC by Walter Bright
Modified: 2024-03-26 05:09 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Walter Bright 2024-03-24 16:41:46 UTC
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
Comment 1 Dlang Bot 2024-03-25 14:08:17 UTC
@ntrel created dlang/dmd pull request #16334 "Fix Bugzilla 24450 - apply VRP to foreach indices when array is of kn…" fixing this issue:

- Fix Bugzilla 24450 - apply VRP to foreach indices when array is of known length

https://github.com/dlang/dmd/pull/16334
Comment 2 Dlang Bot 2024-03-26 05:09:41 UTC
dlang/dmd pull request #16334 "Fix Bugzilla 24450 - apply VRP to foreach indices when array is of kn…" was merged into master:

- c63bb20c83b4452337ceff4d1bfc4ac25835935f by Nick Treleaven:
  Fix Bugzilla 24450 - apply VRP to foreach indices when array is of known length

https://github.com/dlang/dmd/pull/16334