Scope checking on static array struct doesn't kick in
Nordlöw via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue May 9 06:30:49 PDT 2017
On Tuesday, 9 May 2017 at 12:25:29 UTC, Nordlöw wrote:
> On Tuesday, 9 May 2017 at 11:52:35 UTC, Nordlöw wrote:
>> I've tagged the ref-returning functions (in this case
>> `opSlice`) with `return scope` for my statically allocated
>> array struct at
>
> Here's a simpler example
>
> https://github.com/nordlow/phobos-next/blob/cf85f449d24981fbe6269f8096db23282e2fbb65/tests/test_scope.d
If I change the return value of `S.opSlice` to `int[]` correct
`scope`-error handling kicks in.
Tha is, scope checking via -dip1000 works for
struct S
{
@safe pure nothrow @nogc
int[] opSlice() return scope
{
return x[];
}
int[4] x;
}
but not for
struct S
{
@safe pure nothrow @nogc
auto opSlice() return scope
{
return x[];
}
int[4] x;
}
.
I'll write a Bugzilla issue later today.
More information about the Digitalmars-d-learn
mailing list