NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Warning (level 3) C4293

new in default argument will not free memory if initialization throws an exception

Because an exception can happen while creating an instance of an object, the destructor must be accessible and unambiguous so that the object can be deleted correctly.

Possible solutions

Example

// compiled with (/GX)
class B {
public:
    void *operator new(unsigned int);
};

class D : public B {
protected:
    void operator delete(void *);
};

class E : public D {
public:
    E();
    ~E();
};

class X {
public:
    X(class E);
};

void f()
{
    X x(E *e = new E); // warning C4293, delete not accessible (protected)
}