[Issue 23377] New: class method overloading with same name doesn't work for base classes
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Sep 26 17:52:05 UTC 2022
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 at puremagic.com
Reporter: contact at 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) {}
}
--
More information about the Digitalmars-d-bugs
mailing list