[Issue 19752] dip1000 isn't @safe if struct contains a slice

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 20 09:35:31 UTC 2019


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

--- Comment #3 from Atila Neves <atila.neves at gmail.com> ---
> I believe this is because adding a slice member to Container makes it a type with indirections, whereas it was not before. DIP1000 only applies to types with indirections.

In either case, `Range` is a type with an indirection, and `this` is an
indirection itself, so the error message that "cannot take the address of a
scope parameter this is @safe function range" makes no sense. The function is
deliberately `return scope` so that the lifetime of the return value is tied to
`this` and shouldn't be able to outlive it.

--


More information about the Digitalmars-d-bugs mailing list