[Issue 22879] super call ignores overload in mixin

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 12 12:52:55 UTC 2022


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

Adam D. Ruppe <destructionator at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |destructionator at gmail.com

--- Comment #1 from Adam D. Ruppe <destructionator at gmail.com> ---
The presence of that alias complicates things. A template mixin work by name
and thus doesn't bring in something that's already there. So with the mixin,
`f` is already there, meaning the mixin template's one is overridden by that.
That `B.f` function is never part of the virtual tree at all, so `super` here
isn't wrong.

I expect the alias is there in the real thing because of overloading arguments
in the real thing right?

What you actually want to do is to alias BOTH sets together, not just one:

```
class B: A
{
    alias f = A.f;
    alias f = x.f;
    mixin X!() x;
}
```

This combines the overloads of A with the overloads of X, thus allowing the
override to take effect.

This should probably be closed as not a bug, since it is working as designed...

--


More information about the Digitalmars-d-bugs mailing list