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

          Issue ID: 23933
           Summary: auto return type disables DIP1000 scope check
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nob...@puremagic.com
          Reporter: atila.ne...@gmail.com

This fails to compile with -preview=dip1000:

---------------
struct Struct {
    int* p;
    void hmm(int i) @safe { }
}

void safeUsage() @safe {
    int i;
    scope s = Struct();
    s.hmm(42);
}
---------------
bug.d(9): Error: scope variable `s` assigned to non-scope parameter `this`
calling `hmm`



But changing `hmm`'s return type to `auto` makes the error go away.

--

Reply via email to