[Issue 19925] New: static opDispatch not considered in WithStatement

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 31 08:40:57 UTC 2019


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

          Issue ID: 19925
           Summary: static opDispatch not considered in WithStatement
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: simen.kjaras at gmail.com

The below code does not compile, but should:

unittest {
    with (S) {
        a(); // Compiles!
        b(); // Fails!
    }
}

struct S {
    static void a() {}
    static void opDispatch(string name)() {}
}

To make it worse, this compiles:

unittest {
    with (S.init) {
        a(); // Compiles!
        b(); // Compiles!
    }
}

, showing that static methods are considered when looking up methods of an
instance.

--


More information about the Digitalmars-d-bugs mailing list