[Issue 21756] Immutable array literals cause runtime GC allocation instead of static readonly section allocation

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 31 18:24:48 UTC 2021


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

Dlang Bot <dlang-bot at dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #3 from Dlang Bot <dlang-bot at dlang.rocks> ---
@TungstenHeart created dlang/dmd pull request #12329 "fix 21756 - make
`cast(immutable)arrayLiteral` @nogc" fixing this issue:

- fix 21756 - make `cast(immutable)arrayLiteral` @nogc

  adjust array literal semantics so that

  ```d
  cast(immutable) <arrayLiteral>
  ```

  gets rewritten to a DeclExp comma VarExp

  ```d
  (static immutable __array = <arrayLiteral>, __array)
  ```

  allowing immutable array literals to be `@nogc`

https://github.com/dlang/dmd/pull/12329

--


More information about the Digitalmars-d-bugs mailing list