operator&&, operator|| or operator, is overloaded, which loses the evaluation order and short-circuiting of the built-in operator
What it finds
The built-in && and || skip their right operand when the left decides the result, and the built-in comma evaluates left to right. Overloads are ordinary function calls that evaluate both operands, which surprises readers of a && b.
From the rule's source, overloaded_logical_operator.rs.
Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/cpp:overloaded-logical-operator" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/cpp:overloaded-logical-operator] reason="..."tx0 explain tx0/cpp:overloaded-logical-operator shows the same in the terminal. Found a false positive? Report it.