auto foo = [1:1]; Getting the following errors for the above statement: Error: cannot infer type from this array initializer Error: array initializers as expressions are not allowed Error: cannot use array to initialize int Error: array initializers as expressions are not allowed variable foo is not a static and cannot have static initializer A nice workaround would be: auto foo = ([1:1]); // Works only in function bodies. Otherwise getting: Error: non-constant expression [1:1]
As dmd 2.048, this issue is already fixed.