docs: document the return type restrictions for operator overloading (#20529)

This commit is contained in:
Andreas Evensen 2024-01-14 16:31:47 +01:00 committed by GitHub
parent cb224076ec
commit acf75c71da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6191,6 +6191,8 @@ To improve safety and maintainability, operator overloading is limited.
- When overriding `<` and `==`, the return type must be strictly `bool`.
- Both arguments must have the same type (just like with all operators in V).
- Overloaded operators have to return the same type as the argument
(the exceptions are `<` and `==`).
#### Other restrictions