Skip to content

Commit

Permalink
Fix issue 19171 - Fix invalid assert in Array!bool slicing
Browse files Browse the repository at this point in the history
  • Loading branch information
schveiguy committed Aug 15, 2018
1 parent 1e32727 commit 5a3a181
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion std/container/array.d
Expand Up @@ -1664,8 +1664,9 @@ if (is(Unqual!T == bool))
/// ditto
Range opSlice(size_t low, size_t high)
{
// Note: indexes start at 0, which is equivalent to _a
assert(
_a <= low && low <= high && high <= _b,
low <= high && high <= (_b - _a),
"Using out of bounds indexes on an Array"
);
return Range(_outer, _a + low, _a + high);
Expand Down Expand Up @@ -2178,6 +2179,7 @@ if (is(Unqual!T == bool))
slice.front = true;
slice.back = true;
slice[1] = true;
slice = slice[0 .. $]; // bug 19171
assert(slice.front == true);
assert(slice.back == true);
assert(slice[1] == true);
Expand Down

0 comments on commit 5a3a181

Please sign in to comment.