I've tried different things and that here indeed compiles, but does not work as it should/I want.

typeof(this) opCall(U, V)(U x, V y) if (__traits(compiles, { this.x = 5; })) {
        writeln("unstatic opCall");
        this.Set(x, y);

        return this;
}

static Vector2D!(T) opCall(U, V)(U x, V y) if (!__traits(compiles, { this.x = 5; })) {
        return new Vector2D!(T)(to!(T)(x), to!(T)(y));
}

Reply via email to