[Issue 22539] [dip1000] slicing of returned ref scope static array should not be allowed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 27 19:57:20 UTC 2021


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

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at digitalmars.com

--- Comment #2 from Walter Bright <bugzilla at digitalmars.com> ---
I suspect the problem is actually this line:

    scope int*[1] x = [&stackVar];

Since scope is not transitive, allowing this causes the compiler to lose track
of stack addresses, and will allow escapes.

--


More information about the Digitalmars-d-bugs mailing list