Skip to content

Commit 1382f66

Browse files
committed
fix #14637
1 parent 8f62251 commit 1382f66

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lib/checkunusedvar.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ static const Token* doAssignment(Variables &variables, const Token *tok, bool de
565565
variables.readAll(varid2, tok);
566566
}
567567
}
568-
} else if (var1->mType == Variables::reference) {
568+
} else if (var1->mType == Variables::reference || var1->mType == Variables::referenceArray) {
569569
variables.alias(varid1, varid2, true);
570570
} else if (var1->mType == Variables::standard && addressOf) {
571571
variables.alias(varid1, varid2, true);
@@ -738,6 +738,8 @@ void CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(const Scope* const
738738
if (type == Variables::none || isPartOfClassStructUnion(i->typeStartToken()))
739739
continue;
740740
const Token* defValTok = i->nameToken()->next();
741+
if (Token::Match(i->nameToken()->previous(), "& %var% )"))
742+
defValTok = defValTok->next();
741743
while (defValTok && defValTok->str() == "[")
742744
defValTok = defValTok->link()->next();
743745
if (Token::simpleMatch(defValTok, ") ("))

0 commit comments

Comments
 (0)