Fixed #1841 (STL: false negative for invalidated iterator after erase)

This commit is contained in:
Marek Zmysłowski 2011-11-25 07:34:50 +01:00 committed by Daniel Marjamäki
parent 3ae96600b5
commit a8f2dc1fec
1 changed files with 12 additions and 0 deletions

View File

@ -595,6 +595,18 @@ private:
" }\n" " }\n"
"}\n"); "}\n");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
check("void f(int x)\n"
"{\n"
" for (iterator it = foo.begin(); it != foo.end(); ++it)\n"
" {\n"
" foo.erase(it);\n"
" if (x)"
" return;\n"
" }\n"
"}\n");
ASSERT_EQUALS("[test.cpp:5]: (error) Dangerous iterator usage after erase()-method.\n", errout.str());
} }
void eraseContinue() { void eraseContinue() {