www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23377] New: class method overloading with same name doesn't


          Issue ID: 23377
           Summary: class method overloading with same name doesn't work
                    for base classes
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: contact lsferreira.net

The compiler doesn't check the base class overloads when the correct overload
is provided, only on the base class, but contains an incorrect overload on the
derived class. If the derived class doesn't have any overload, it works. E.g.:


struct Foo
    void foo(Bar b)

struct Foobar {}
struct Foobar2 {}

class Base
    void bar(Foo f) {}
    void bar(Foobar2 f) {}

class Bar : Base
    void call()
        Foo f;

    // if you comment this it will choose the right overload, therefore it
    void bar(Foobar f) {}

Sep 26 2022