Fixed #1841 (STL: false negative for invalidated iterator after erase)
This commit is contained in:
parent
3ae96600b5
commit
a8f2dc1fec
|
@ -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() {
|
||||||
|
|
Loading…
Reference in New Issue