Ticket #2881 (new enhancement)
container use after clear
| Reported by: | tehuser | Owned by: | noone |
|---|---|---|---|
| Priority: | Milestone: | ||
| Component: | New check | Keywords: | |
| Cc: |
Description
Sorry if this is a duplicate. I used the search to find out, but couldn't see any.
#include <map>
#include <iostream>
using namespace std;
int main()
{
map<int, int> m;
m[0]=2;
m[1]=4;
m[2]=-2;
m[3]=-5;
m.clear();
cerr << m[2] << endl;
}
$gcc test.cpp -o test -Wall --pedantic -lstdc++
$cppcheck --enable=all test.cpp
Checking test.cpp...
$cppcheck --version
Cppcheck 1.48
Change History
Note: See
TracTickets for help on using
tickets.