December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=14772

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--
July 05, 2023
https://issues.dlang.org/show_bug.cgi?id=14772

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick@geany.org

--- Comment #1 from Nick Treleaven <nick@geany.org> ---
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.

--