https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120890

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This code is undefined.

Doing:
  vBaseClass *
    testObjs = new derivedClass[2];
...
  delete[]testObjs;


is undefined. For arrays, you have to do the delete on the same type as being
created.

https://stackoverflow.com/questions/6171814/why-is-it-undefined-behavior-to-delete-an-array-of-derived-objects-via-a-base

Reply via email to