You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RULE-7-0-4: false positives on overloaded operator<</operator>> in uninstantiated template bodies #1177
InappropriateBitwiseOrShiftOperands.ql reports operations that do not use the built-in bitwise or shift operators. The overwhelming majority of these are uses of the stream insertion and extraction operators, e.g. stream << value .
On our codebase ( eclipse-score/communication ) this accounts for 72 of 76 reported violations, i.e. ~95% of the results for this rule are false positives.
Typical messages:
Shift operator '<<' requires unsigned left operand, but has type 'basic_ostream<char, char_traits<char>> &'.
Shift operator '<<' requires unsigned left operand, but has type 'unknown'.
Shift operator '<<' requires unsigned right operand, but has type 'auto &&'.
Shift operator '<<' requires unsigned right operand, but has type 'const char[22]'.
Example
template<typename ServiceIdType>
std::string ToHexString(const ServiceIdType service_id) {
std::stringstream stream;
// FALSE POSITIVE: reported twice, for the left and the right operand
stream << std::setfill('0') << std::setw(8) << std::hex << service_id;
return stream.str();
}
changed the title [-]`RULE-7-0-4`: alse positives on overloaded `operator<<`/`operator>>` in uninstantiated template bodies[/-][+]`RULE-7-0-4`: false positives on overloaded `operator<<`/`operator>>` in uninstantiated template bodies[/+]on Aug 21, 2026
Activity
[-]`RULE-7-0-4`: alse positives on overloaded `operator<<`/`operator>>` in uninstantiated template bodies[/-][+]`RULE-7-0-4`: false positives on overloaded `operator<<`/`operator>>` in uninstantiated template bodies[/+]Fix RULE-7-0-4 false positives for non-numeric operand types
Fix RULE-7-0-4 false positives for non-numeric operand types