Mixin template overloads not working
Rumbu
rumbu at rumbu.ro
Tue Dec 7 12:43:40 UTC 2021
On Friday, 3 December 2021 at 10:57:34 UTC, Stanislav Blinov
wrote:
> On Friday, 3 December 2021 at 10:42:37 UTC, Rumbu wrote:
>
>> Bug or feature? Is there any workaround?
>
> The error message explains what to do :)
>
>> Error: class `mixinover.AnotherVisitor` use of
>> `mixinover.Visitor.visit(S s)` is hidden by `AnotherVisitor`;
>> use `alias visit = Visitor.visit;` to introduce base class
>> overload set
Yes, I know, but in fact the compiler wrongly assumes that
visit(A) is hiding visit(S). visit(A) is just an overload, it has
a different signature than visit(S), theoretically the compiler
must mangle it using a different name.
Finally I solved it by "finalizing" visit(S), so it's not taken
into overrides set.
```d
class Visitor
{
final void visit(S s) {}
//...
}
More information about the Digitalmars-d-learn
mailing list