https://issues.dlang.org/show_bug.cgi?id=19338
--- Comment #2 from Richard Palme <richardpalm...@gmail.com> --- The phobos implementation of this function is: -------------------------------------------------------------------- size_t count() { size_t bitCount; foreach (i; 0 .. fullWords) bitCount += countBitsSet(_ptr[i]); bitCount += countBitsSet(_ptr[fullWords] & endMask); return bitCount; } -------------------------------------------------------------------- My guess would be that for an empty BitArray, _ptr is null. count() then tries to access _ptr[fullWords], which leads to the segfault. --