Ok thanks to everyone for their help. So I tried what you suggested and so the problem was bracketing.
For future reference, the above code can be fixed into this: class Foo { private static Foo[] fooSlice; //private static slicestatic const(Foo[]) getFooList() { //static method returning a constant slice
return fooSlice; } }