Skip to content

Commit

Permalink
std.cfg: #Ticket 1544: Added regression tests (eraseIteratorOutOfBoun…
Browse files Browse the repository at this point in the history
…ds) (#6800)
  • Loading branch information
orbitcowboy committed Sep 15, 2024
1 parent d1ca4e3 commit 97c5886
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/cfg/std.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <iostream>
#include <istream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <mutex>
Expand Down Expand Up @@ -5190,6 +5191,23 @@ void unreadVariable_std_format_error(char * c)
}
#endif

void eraseIteratorOutOfBounds_std_list1()
{
std::list<int> a;
std::list<int>::iterator p = a.begin();
// cppcheck-suppress eraseIteratorOutOfBounds
a.erase(p);
}
int eraseIteratorOutOfBounds_std_list2()
{
std::list<int> a;
std::list<int>::iterator p = a.begin();
std::list<int>::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
Expand Down

0 comments on commit 97c5886

Please sign in to comment.