[Issue 15932] Get rid of the implicit slicing of static arrays

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 7 10:42:12 UTC 2022


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

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305 at gmail.com
         Resolution|---                         |FIXED

--- Comment #2 from RazvanN <razvan.nitu1305 at gmail.com> ---
If you annotate the functions with @safe then you get:

test.d(9): Deprecation: reference to local variable `data` assigned to
non-scope parameter `_data` calling `this`

I think that having the compiler automatically slice your static arrays is
actually quite nice as you have to type less. The fact that you can escape a
pointer to an expired stack frame is something that @safe and scope should deal
with. Still, in system code this should be perfectly fine.

Closing this as WORKSFORME.

--


More information about the Digitalmars-d-bugs mailing list