Fixed #9221 (False positive when using an array of lists)

This commit is contained in:
Daniel Marjamäki 2020-04-10 14:01:15 +02:00
parent eff225a09c
commit 32bf53eeda
1 changed files with 1 additions and 1 deletions

View File

@ -2047,7 +2047,7 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Function *func, bool&
if (lhs->previous()->variable()->typeStartToken()->strAt(-1) != "const" && lhs->previous()->variable()->isPointer())
return false;
}
} else if (lhs->str() == ":" && lhs->astParent() && lhs->astParent()->str() == "(" && tok1->strAt(1) == ")") { // range-based for-loop (C++11)
} else if (lhs->str() == ":" && lhs->astParent() && lhs->astParent()->str() == "(") { // range-based for-loop (C++11)
// TODO: We could additionally check what is done with the elements to avoid false negatives. Here we just rely on "const" keyword being used.
if (lhs->astParent()->strAt(1) != "const")
return false;