You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/teststl.cpp
+14Lines changed: 14 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1140,6 +1140,20 @@ class TestStl : public TestFixture {
1140
1140
"[test.cpp:3:11]: note: Assuming that condition 'i>5' is not redundant\n"
1141
1141
"[test.cpp:5:13]: note: Access out of bounds\n",
1142
1142
errout_str());
1143
+
1144
+
check("void f(std::vector<int>& v) {\n"
1145
+
" std::vector<int>::iterator it;\n"
1146
+
" for (it = v.begin(); it != v.end(); ++it) {\n"
1147
+
" if (*it == 0)\n"
1148
+
" break;\n"
1149
+
" }\n"
1150
+
" v.erase(it);\n"
1151
+
"}\n", s);
1152
+
ASSERT_EQUALS("[test.cpp:4:13]: style: Consider using std::find_if algorithm instead of a raw loop. [useStlAlgorithm]\n"
1153
+
"[test.cpp:7:7]: warning: Either the condition is redundant or function 'erase()' is called on the iterator 'it' which is out of bounds. [eraseIteratorOutOfBoundsCond]\n"
1154
+
"[test.cpp:3:29]: note: Assuming that condition 'it!=v.end()' is not redundant\n"
1155
+
"[test.cpp:7:7]: note: Either the condition is redundant or function 'erase()' is called on the iterator 'it' which is out of bounds.\n",
0 commit comments