Fixed #2450 (False positive when iterator reused)
This commit is contained in:
parent
36c1807228
commit
b247d7d56e
|
@ -968,7 +968,7 @@ void CheckStl::missingComparison()
|
||||||
incrementToken = tok3;
|
incrementToken = tok3;
|
||||||
else if (tok3->varId() == iteratorId && Token::Match(tok3->next(), "!=|=="))
|
else if (tok3->varId() == iteratorId && Token::Match(tok3->next(), "!=|=="))
|
||||||
incrementToken = 0;
|
incrementToken = 0;
|
||||||
else if (tok3->str() == "break")
|
else if (tok3->str() == "break" || tok3->str() == "return")
|
||||||
incrementToken = 0;
|
incrementToken = 0;
|
||||||
}
|
}
|
||||||
if (incrementToken)
|
if (incrementToken)
|
||||||
|
|
|
@ -1118,6 +1118,16 @@ private:
|
||||||
" }\n"
|
" }\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
check("function f1(std::list<int> &l1) {\n"
|
||||||
|
" for(std::list<int>::iterator i = l1.begin(); i != l1.end(); i++) {\n"
|
||||||
|
" if (*i == 44) {\n"
|
||||||
|
" l1.insert(++i, 55);\n"
|
||||||
|
" return;\n"
|
||||||
|
" }\n"
|
||||||
|
" }\n"
|
||||||
|
"}");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void missingInnerComparison5()
|
void missingInnerComparison5()
|
||||||
|
|
Loading…
Reference in New Issue