Bug 19171 – Array!bool range slicing has invalid assert
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-08-15T18:12:09Z
Last change time
2018-08-16T05:24:56Z
Keywords
pull
Assigned to
No Owner
Creator
Steven Schveighoffer
Comments
Comment #0 by schveiguy — 2018-08-15T18:12:09Z
assert is as follows:
assert(
_a <= low && low <= high && high <= _b,
"Using out of bounds indexes on an Array"
);
Where _a and _b are the low and high indexes into the original array, where `low` and `high` are the indexes passed into the range.
Instead it should be:
low <= high && high <= (_b - _a)
as the index is 0 based, not based on _a.