[Issue 23162] cannot use new on a static array type that's aliased
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jun 8 13:05:29 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23162
RazvanN <razvan.nitu1305 at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |razvan.nitu1305 at gmail.com
--- Comment #1 from RazvanN <razvan.nitu1305 at gmail.com> ---
I think that this bug report is invalid. As can be seen, the grammar for new
expression is: https://dlang.org/spec/grammar.html#NewExpression .
So the parser sees `new A` and it thinks that you have the first form of new
expression. And I think this is the right behavior. Since A is binded to
int[1], the compiler thinks you are newing a type and it is illegal to allocate
a static array with the GC. Adding this special case in the compiler is not
worth it.
--
More information about the Digitalmars-d-bugs
mailing list