[Issue 22157] New: Bad diagnostic for static/non-static overload resolution conflict

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 29 11:31:58 UTC 2021


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

          Issue ID: 22157
           Summary: Bad diagnostic for static/non-static overload
                    resolution conflict
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: maxsamukha at gmail.com

(1):

struct S {
    static void foo() {
    }

    void foo() {
    }
}

void main() {
    S.foo;
}

onlineapp.d(10): Error: `onlineapp.S.foo` called with argument types `()`
matches both:
onlineapp.d(2):     `onlineapp.S.foo()`
and:
onlineapp.d(5):     `onlineapp.S.foo()`


(2):

struct S {
    void foo() {
    }

    static void foo() {
    }
}

void main() {
    S.foo;
}

onlineapp.d(10): Error: need `this` for `foo` of type `void()`



In both cases, the "matches both" error is expected.

--


More information about the Digitalmars-d-bugs mailing list