Fixed false positive #4123.
This commit is contained in:
parent
8c577800b1
commit
6edec7bdce
|
@ -145,7 +145,7 @@ void CheckStl::iterators()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reassign the iterator
|
// Reassign the iterator
|
||||||
else if (Token::Match(tok2, "%varid% = %var%", iteratorId)) {
|
else if (Token::Match(tok2, "%varid% = %any%", iteratorId)) {
|
||||||
// Assume that the iterator becomes valid.
|
// Assume that the iterator becomes valid.
|
||||||
// TODO: add checking that checks if the iterator becomes valid or not
|
// TODO: add checking that checks if the iterator becomes valid or not
|
||||||
validatingToken = Token::findmatch(tok2->tokAt(2), "[;)]");
|
validatingToken = Token::findmatch(tok2->tokAt(2), "[;)]");
|
||||||
|
|
|
@ -66,6 +66,7 @@ private:
|
||||||
TEST_CASE(eraseGoto);
|
TEST_CASE(eraseGoto);
|
||||||
TEST_CASE(eraseAssign1);
|
TEST_CASE(eraseAssign1);
|
||||||
TEST_CASE(eraseAssign2);
|
TEST_CASE(eraseAssign2);
|
||||||
|
TEST_CASE(eraseAssign3);
|
||||||
TEST_CASE(eraseErase);
|
TEST_CASE(eraseErase);
|
||||||
TEST_CASE(eraseByValue);
|
TEST_CASE(eraseByValue);
|
||||||
|
|
||||||
|
@ -858,6 +859,15 @@ private:
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void eraseAssign3() {
|
||||||
|
check("void f(std::list<list<int> >& l) {\n"
|
||||||
|
" std::list<std::list<int> >::const_iterator i = l.begin();\n"
|
||||||
|
" std::list<int>::const_iterator j = (*i).begin();\n"
|
||||||
|
" cout << *j << endl;\n"
|
||||||
|
"}");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
void eraseErase() {
|
void eraseErase() {
|
||||||
check("void f(std::vector<ints> &ints)\n"
|
check("void f(std::vector<ints> &ints)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
Loading…
Reference in New Issue