[Issue 19111] Returning a reference to local array results in garbage

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 26 10:34:02 UTC 2018


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

--- Comment #3 from anonymous4 <dfj1esp02 at sneakemail.com> ---
(In reply to Alex from comment #0)
> I suggest that int[10] should be on the heap unless the compiler can be sure
> that there isn't a way for a reference to escape.
LDC does the opposite: it performs D-specific optimizations and promotes heap
allocations to stack if it detects that the allocation is properly scoped.

--


More information about the Digitalmars-d-bugs mailing list