diff --git a/std/container/array.d b/std/container/array.d index 93e861b7e95..b8aadf3c69c 100644 --- a/std/container/array.d +++ b/std/container/array.d @@ -1930,11 +1930,11 @@ if (is(Unqual!T == bool)) // Fits within the current array if (stuff) { - data[$ - 1] |= (1u << rem); + data[$ - 1] |= (cast(size_t)1 << rem); } else { - data[$ - 1] &= ~(1u << rem); + data[$ - 1] &= ~(cast(size_t)1 << rem); } } else @@ -1961,6 +1961,15 @@ if (is(Unqual!T == bool)) /// ditto alias stableInsertBack = insertBack; + unittest + { + Array!bool a; + for (int i = 0; i < 100; ++i) + a.insertBack(true); + foreach (e; a) + assert(e); + } + /** Removes the value at the front or back of the container. The stable version behaves the same, but guarantees that ranges