[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 22:41:19 UTC 2021


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

--- Comment #11 from Dennis <dkorpel at live.nl> ---
(In reply to Walter Bright from comment #10)
> No error; bad. The slicing of the return value of identity() is not properly
> propagating the scope-ness of its argument x. This would be a problem in
> escape.d.

Yes, the scope-ness is lost because there is no transitive scope, so the
slicing shouldn't be allowed in @safe code. It's essentially the same as:
https://issues.dlang.org/show_bug.cgi?id=20691

Which you fixed with:
https://github.com/dlang/dmd/pull/10951

But that fix is limited to variables, not return values, so my pull request
extends it by also considering slicing a CallExp:
https://github.com/dlang/dmd/pull/13362

I don't understand what your comment is getting at, do you have any objections
to this?

--


More information about the Digitalmars-d-bugs mailing list