diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index 27c152974be..283e3b9a62e 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -5190,6 +5191,23 @@ void unreadVariable_std_format_error(char * c) } #endif +void eraseIteratorOutOfBounds_std_list1() +{ + std::list a; + std::list::iterator p = a.begin(); + // cppcheck-suppress eraseIteratorOutOfBounds + a.erase(p); +} +int eraseIteratorOutOfBounds_std_list2() +{ + std::list a; + std::list::iterator p = a.begin(); + std::list::iterator q = p; + // cppcheck-suppress eraseIteratorOutOfBounds + a.erase(q); + return *q; +} + void containerOutOfBounds_std_string(std::string &var) { // #11403 std::string s0{"x"}; // cppcheck-suppress containerOutOfBounds