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

bd satish bdsatish at gmail.com
Sun May 20 11:23:15 PDT 2012


Thanks Dmitri and Howard. Given this declaration:

Base* ptr = new Derived[3];

is there any other "fool-proof" alternative to ensure that the
destructor of Derived objects are always called ? Since it works for
scalar cases, like,

Base* ptr = new Derived;
delete ptr;

as an end user, I expect the array version also to behave as such. I
wonder why the standards decided to make this as "undefined" behavior.

--Satish. BD



-- 
-- Satish.BD        +358 442222309



More information about the cfe-dev mailing list