[Issue 22270] [DIP1000] class does infer scope in methods when assigned to a scope variable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 3 14:48:16 UTC 2021


--- Comment #3 from Dennis <dkorpel at live.nl> ---
(In reply to João Lourenço from comment #2)
> So I just tested this and it compiled fine with DIP1000

I forgot to mention, you also need to give `Bar` at least one pointer member.

struct Bar
    int* x;
    @safe void dummy() {}

void main()
    scope bar = Bar();
    bar.dummy; // ok

onlineapp.d(11): Error: scope variable `bar` assigned to non-scope parameter
`this` calling onlineapp.Bar.dummy


More information about the Digitalmars-d-bugs mailing list