www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22157] New: Bad diagnostic for static/non-static overload

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 puremagic.com
          Reporter: maxsamukha 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.

--
Jul 29