When you have 2 mixin templates that both overload the same operator, you can't use alias declarations to combine overloads.
Tested on dmd-2.076.1 and dmd-2.073.2
```
mixin template A() {
auto opBinary(string op, T)(T other) if (op == "in") {
return other;
}
}
mixin template B() {
auto opBinary(string op, T)(T other) if (op == "&") {
return other;
}
}
mixin template C() {
mixin A a;
mixin B b;
alias opBinary = a.opBinary;
alias opBinary = b.opBinary;
}
struct Foo {
mixin A a;
mixin B b;
alias opBinary = a.opBinary;
alias opBinary = b.opBinary;
}
struct Bar {
mixin C;
}
struct TestA {
mixin A;
}
struct TestB {
mixin B;
}
void main() {
// These examples work
auto test1 = Foo().opBinary!"in"("foo");
auto test2 = Foo().opBinary!"&"("foo");
auto testa = TestA() in "foo";
auto testb = TestB() & "foo";
// These fail to compile
auto test4 = Foo() in "foo";
auto test5 = Foo() & "foo";
auto test6 = Bar() in "bar";
auto test7 = Bar() & "bar";
}
```
Comment #1 by robert.schadek — 2024-12-13T18:55:43Z