Fixed ticket #477 (Bug in Token::Match() during process TestStl::pushback3)

http://sourceforge.net/apps/trac/cppcheck/ticket/477
This commit is contained in:
Slava Semushin 2009-07-18 17:06:51 +07:00
parent 4622f9891c
commit aab06eaeab

View File

@ -317,13 +317,15 @@ private:
{ {
check("void f()\n" check("void f()\n"
"{\n" "{\n"
" std::vector<int>::const_iterator it = foo.begin();\n" " std::vector<int> foo;\n"
" foo.push_back(10);\n"
" std::vector<int>::iterator it;\n"
" for (it = foo.begin(); it != foo.end(); ++it)\n" " for (it = foo.begin(); it != foo.end(); ++it)\n"
" {\n" " {\n"
" foo.push_back(123);\n" " foo.push_back(123);\n"
" }\n" " }\n"
"}\n"); "}\n");
ASSERT_EQUALS("[test.cpp:6]: (error) After push_back or push_front, the iterator 'it' may be invalid\n", errout.str()); ASSERT_EQUALS("[test.cpp:8]: (error) After push_back or push_front, the iterator 'it' may be invalid\n", errout.str());
} }
void pushback4() void pushback4()