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.
Comment #1 by schveiguy — 2018-08-15T18:26:42Z
Comment #2 by github-bugzilla — 2018-08-16T05:24:55Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/5a3a1819223f3cc4d70565000d8a083b6a65aced Fix issue 19171 - Fix invalid assert in Array!bool slicing https://github.com/dlang/phobos/commit/4b98bd8b44dde9bb1ede66de4600cc0af38fb457 Merge pull request #6666 from schveiguy/fix19171 Fix issue 19171 - Fix invalid assert in Array!bool slicing merged-on-behalf-of: Nathan Sashihara <[email protected]>