Why do you expect it to pass?
first *= 3changes first, so it does not retain its original meaning.
Perhaps you wanted to write
Vector2 result = first * 3;
?
There is also a problem with Vector2 opBinary(string op)(const float rhs)
This function is used in a type expression 10 * v. Your code changes thisin the expression this *= rhs. This function must be implemented:
auto result = this;
result *= rhs;
return result;
source
share