September 26, 2022 [Issue 23377] New: class method overloading with same name doesn't work for base classes | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23377 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) { b.bar(this); } } struct Foobar {} struct Foobar2 {} class Base { void bar(Foo f) {} void bar(Foobar2 f) {} } class Bar : Base { void call() { Foo f; f.foo(this); } // if you comment this it will choose the right overload, therefore it works void bar(Foobar f) {} } -- |
Copyright © 1999-2021 by the D Language Foundation