digitalmars.D.bugs - [Issue 23300] New: std.array : array wrongly propagates scopeness of
- d-bugmail puremagic.com (27/27) Aug 20 2022 https://issues.dlang.org/show_bug.cgi?id=23300
https://issues.dlang.org/show_bug.cgi?id=23300 Issue ID: 23300 Summary: std.array : array wrongly propagates scopeness of source Product: D Version: D2 Hardware: All URL: http://dlang.org/ OS: All Status: NEW Severity: normal Priority: P3 Component: phobos Assignee: nobody puremagic.com Reporter: Ajieskola gmail.com This should compile but does not on dmd 2.100, using -preview=dip1000 flag. ------------- safe int[] fun() { import std : array, map; scope r = [1,2,3].map!"a+3"; return r.array; } ------------- Were I returning `r` directly, this would be escaping a reference to scoped data, but `array` copies the data. Returning `array`ed range should be allowed, `scope` or no. --
Aug 20 2022