Not sure if this is a bug or just rather counter-intuitive: BitArray test; test.length = 7; BitArray test2 = test.dup; test2[0] = 1; This is fine, test is not modified. BitArray test[7]; foreach(ref i;test) i.length = 7; BitArray[7] test2 = test.dup; test2[0] = 1; test has been modified. Why doesn't dup work here?