class Widget
{
public:
Widget() {
cout<<\"~Widget()\"<
I don't have a good answer, but I have simplified the issue slightly. The following code removes the operator new and exception handling:
#include
using namespace std;
class Widget {
public:
Widget() {
cout<<"Widget()"<
This still exhibits the same behaviour and des so on both VC++ and g++.
Of course, deleting a NULL pointer is a no-op, so the compiler does not have to call operator delete. If one actually allocates an object:
Widget* w = new Widget;
then things work as expected.