[Issue 19010] new fails on dynamic array aliases

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 21 16:04:14 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19010

ag0aep6g <ag0aep6g at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ag0aep6g at gmail.com

--- Comment #1 from ag0aep6g <ag0aep6g at gmail.com> ---
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

--


More information about the Digitalmars-d-bugs mailing list