Pretty simple example: ``` unittest { alias T = int[]; T t = new T; } ``` This doesn't seem to have ever compiled correctly. It currently fails with the misleading error "Error: new can only create structs, dynamic arrays or class objects, not int[]'s"
The alias has nothing to do with the error. This gives the same error: ---- unittest { int[] t = new int[]; /* Error: new can only create structs, dynamic arrays or class objects, not int[]'s */ } ---- (In reply to elpenguino+D from comment #0) > This doesn't seem to have ever compiled correctly. As far as I know, `new int[]` is not supposed to compile. The spec [1] is a bit scarce on this, but `new`ing arrays is only mentioned with explicit lengths. [1] https://dlang.org/spec/expression.html#new_expressions
Grammartically it's valid (it's the first new rule, i.e `new AllocatorArgumentsopt Type`) but since `new` for arrays doesn't return a pointer to an array, allowing this would be a bit pointless because `int[] a = new int[];` would be the same as `int[] a;`
The problem is actually a bad diagnostic. This is like 20422, i.e the length parameter misses. *** This issue has been marked as a duplicate of issue 20422 ***