Comment #0 by verylonglogin.reg — 2012-05-04T02:33:36Z
IMHO this should rise a compiler error:
---
mixin template T() {
override string f() { return "T"; }
}
class A {
string f() { return "A"; }
}
class B: A {
mixin T;
override string f() { return "B"; }
mixin T;
}
void main() {
A b = new B;
assert(b.f() == "B"); // This passes
}
---
Comment #1 by verylonglogin.reg — 2012-05-04T04:48:06Z
Or, if this shouldn't rise an error, this also should compiles:
---
class B: A {
mixin T;
mixin T;
override string f() { return "B"; }
}
---
Error: function main.B.T!().f multiple overrides of same function
Comment #2 by andy-hanson — 2016-04-10T00:10:58Z
Related: overloads don't appear to be recognized from within mixin templates.
---
class X {
void x() {}
mixin template T() {
void x(int y) { x(); }
}
mixin T;
}
// app.d(4): Error: function app.X.T!().x (int y) is not callable using argument types ()
Comment #3 by robert.schadek — 2024-12-13T17:59:45Z