I've been working on a project that involves overloading and inheritance and I've run into a bit of a problem. My code looks something like this: class Base { void get(ubyte b); } class Derived: Base { alias Base.get get; void get(string s); } When I try to compile it, DMD says that the alias Derived.get conflicts with Derived.get(string). This behavior makes sense to a degree (declaring get(string) is creating a new overload instead of overriding an old one), but it's probably not what anyone wants. It should be a fairly simple fix; just a little special-case code in DMD for this type of alias or something...
For some reason, it appears that my test case actually does compile :) I guess I'd better check my test cases next time. The original code is still broken, though; I'll try to put together a test case that actually breaks.
I found a test case that should work: class Base { template getter(T) { void get(ref T[] i, uint n) {} } mixin getter!uint; mixin getter!char; } class Derived: Base { alias Base.get get; void get(ref char[] x) {} } It appears to be a problem with trying to create new overloads when the base class overloads are put there by multiple mixins. Using only one mixin seems to work fine.
The original description is inaccurate; the second comment provides the correct information and test case.
https://github.com/D-Programming-Language/dmd/pull/916
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/7cea8d2bef94d2e7394c4ef96792acd782f73173 fix Issue 7560 - Base class overloaded methods created by mixins can't be overriden https://github.com/D-Programming-Language/dmd/commit/3e1358125feb935445370000ec883dc4afc3befc Merge pull request #916 from 9rnsr/fix7560 Issue 7560 - Base class overloaded methods created by mixins can't be overriden