Trass3r: > In which cases does it work/doesn't it work? This doesn't work, I have shown the given error messages in the original post:
//#3 struct Vec { Vec opOpAssign(string Op)(auto ref Vec other) if (Op == "+=") { return this; } Vec opBinary(string Op:"+")(Vec other) { Vec result; return result += other; } } void main() { Vec v; v += Vec() + Vec(); // line 13 } It works if you remove "auto ref". I think this is a compiler bug. I will put it in bugzilla. The program #1 and 2# are instead correct according to D specs. Bye, bearophile