[cfe-dev] operator delete[] does not call derived class destructor

Dmitri Gribenko gribozavr at gmail.com
Sun May 20 11:01:02 PDT 2012

On Sun, May 20, 2012 at 11:20 AM, bd satish <bdsatish at gmail.com> wrote:
>  Base* ptr = new Derived[3];
>  delete [] ptr;


It seems to me that this is undefined behavior:

[expr.delete]/3: In the second alternative (delete array) if the
dynamic type of the object to be deleted differs from its static type,
the behavior is undefined.


(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/

More information about the cfe-dev mailing list