diff --git a/lib/checkunusedvar.cpp b/lib/checkunusedvar.cpp index 024fa267f..ebd3c7b48 100644 --- a/lib/checkunusedvar.cpp +++ b/lib/checkunusedvar.cpp @@ -976,8 +976,11 @@ void CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(const Scope* const variables.read(tok->next()->varId(), tok); } else // addressof variables.use(tok->next()->varId(), tok); // use = read + write - } else if (Token::Match(tok, ">> %var%")) { - variables.use(tok->next()->varId(), tok); // use = read + write + } else if (Token::Match(tok, ">>|>>= %var%")) { + if (_tokenizer->isC() || tok->previous()->isStandardType()) + variables.read(tok->next()->varId(), tok); + else + variables.use(tok->next()->varId(), tok); // use = read + write } else if (Token::Match(tok, "%var% >>|&") && Token::Match(tok->previous(), "[{};:]")) { variables.read(tok->varId(), tok); }