https://issues.dlang.org/show_bug.cgi?id=14772
Nick Treleaven <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #1 from Nick Treleaven <[email protected]> --- The problem seems to be that `f` does not have length 1: > Vector3[] f; When that is fixed, it works: struct Vector3 { public double[3] arr; Vector3 opBinary(string op)(in Vector3 rhs) const if (op == "+") { Vector3 result; result.arr[] = this.arr[] + rhs.arr[]; return result; } } unittest { auto a = Vector3([2.0, 2.0, 0.0]); auto b = Vector3([1.0, 2.0, 1.0]); Vector3 e = a + b; // works Vector3[] c = [a]; Vector3[] d = [b]; Vector3[1] f; f[] = c[] + d[]; // works } Also I can't reproduce the original error with all the compilers on run.dlang.io , maybe they don't go back that far. --
