cppcheck/test/testsuites/duma/wrong4.cc

27 lines
484 B
C++
Raw Normal View History

2019-03-18 06:58:12 +01:00
#include <noduma.h>
#include <iostream>
#include <dumapp.h>
using namespace std;
int main() {
cout << "Hello world!" << endl;
{
int* pI = new int[10];
cerr << "Let's delete instead of delete [] " << endl;
delete pI;
cerr << "Did you notice?" << endl;
}
{
int* pI = new int[10];
cerr << "Now let's free instead of delete [] " << endl;
free(pI);
cerr << "Did you notice?" << endl;
}
cerr << "There should be 2 errors in this run" << endl;
return 0;
}