[Issue 19171] New: Array!bool range slicing has invalid assert

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 15 18:12:09 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19171

          Issue ID: 19171
           Summary: Array!bool range slicing has invalid assert
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: schveiguy at yahoo.com

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.

--


More information about the Digitalmars-d-bugs mailing list