[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
Thu Apr 1 00:10:12 UTC 2021


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

Mathias LANG <pro.mathias.lang at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pro.mathias.lang at gmail.com

--- Comment #4 from Mathias LANG <pro.mathias.lang at gmail.com> ---
No, `cast` should not do this magic, it should be requested by the user
directly.
So:
```
auto g() { static immutable ret = ['a', 'b', 'c']; return ret; }
```

Leaving open for the benefit of the discussion (I found this issue because
there's a PR), but IMO this is RESOLVED INVALID territory.

--


More information about the Digitalmars-d-bugs mailing list