June 08, 2022 [Issue 23162] cannot use new on a static array type that's aliased | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23162 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |razvan.nitu1305@gmail.com --- Comment #1 from RazvanN <razvan.nitu1305@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. -- |
June 08, 2022 [Issue 23162] cannot use new on a static array type that's aliased | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23162 Basile-z <b2.temp@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #2 from Basile-z <b2.temp@gmx.com> --- indeed, TIL `new int[1]` is like `new int[](1)`. -- |
Copyright © 1999-2021 by the D Language Foundation