// When deleting an array, the dynamic and the static type of the object must be the same, or the behavior is undefined (C++ Standard 5.3.5/3). struct X { int FOO; virtual ~X() { }; }; class Y : public X { public: int BAR; }; int main() { X *p = new Y[2]; delete[] p; return 0; }