I tried this simple code and I'm getting a weird result:
#include <iostream>
class CTest
{
public:
void Function() { std::cout << "CTest::Function()" << std::endl; }
};
int main()
{
CTest *pTest = new CTest;
delete pTest;
pTest = NULL;
pTest->Function();
}
Compiled with GCC with these parameters: g++ -O0 Test.cpp -o Test
When I run the program, I get this result:
$ ./Test
CTest::Function()
How is this possible?