[Issue 23377] class method overloading with same name doesn't work for base classes

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 27 05:47:16 UTC 2022


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

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305 at gmail.com
           Severity|normal                      |enhancement

--- Comment #2 from RazvanN <razvan.nitu1305 at gmail.com> ---
This is intended behavior. For more information check [1]. Long story short,
the current mechanism is in place to prevent hijacking. I guess an argument can
be made that in this case neither A nor C are implicitly convertible to B, but
to me this just seems like adding special cases when the alternative would be
to simply use an alias to introduce fun(B) in the same overload set as the
other fun methods.

I am inclined to close this as a WONTFIX. Either way, this is not a bug, but an
enhancement request by the current language rules.

[1] https://dlang.org/articles/hijack.html#derived-class-members

--


More information about the Digitalmars-d-bugs mailing list