Fix wrong iterator usage. Iterator that is erased must be non-const.

This commit is contained in:
Daniel Marjamäki 2016-12-17 22:20:50 +01:00
parent 72e4bc9d88
commit 4ac5c78e0c
1 changed files with 1 additions and 1 deletions

View File

@ -1467,7 +1467,7 @@ static bool valueFlowForward(Token * const startToken,
const Token * const arg = tok2->next()->astOperand2();
if (arg != nullptr && arg->str() != ",") {
// Should scope be skipped because variable value is checked?
for (std::list<ValueFlow::Value>::const_iterator it = values.begin(); it != values.end();) {
for (std::list<ValueFlow::Value>::iterator it = values.begin(); it != values.end();) {
if (conditionIsFalse(arg, getProgramMemory(tok2, varid, *it)))
values.erase(it++);
else