https://issues.dlang.org/show_bug.cgi?id=15957
--- Comment #3 from Walter Bright <[email protected]> --- (In reply to Walter Bright from comment #2) > https://github.com/dlang/dmd/pull/5713 That's the wrong answer. What's happening is, when the compiler sees the this(this), is it says "I need to create an identity assignment operator S.opAssign(S)." It proceeds to do so, and inserts it into the symbol table of S as a member function. Then, when: s = [1,2,3]; is encountered, it does a lookup of opAssign. It finds S.opAssign(S), and of course that fails to match. Mixed in templates are considered imports as far as looking things up goes. The member functions are not overloaded against them, the member functions override them. This entirely explains the behavior you are reporting. Trying to change the lookup rules will have all kinds of ripple effects, and it's hard to see what they might all be in advance. It would be a high risk change. But there's an easy fix. Add opAssign(ref S) to the mixed in template: template Impl(S) { void opAssign(int[] x) { } @disable void opAssign(ref S); } Now, a default opAssign(S) will not be generated, the lookup will find Impl.opAssign, the two entries will overload against each other, and the first one is the better match. --
