You just discovered a bug: import std.stdio; class Foo(T, int n) { void bar(T[n] array) { array[0] = 42; } } void main() { auto foo = new Foo!(int, 3); invariant(int[3]) array = [0, 1, 2]; //array[0] = 42; Error: array[0] isn't mutable writefln(array); // [0 1 2] foo.bar(array); writefln(array); // [42 1 2] }