TITLE: destructor design error is now undefined behavior [ I thought this was just a design mistake, but it turns out that its behavior is undefined by the language standard! -adc class Base { public: ~Base (); // non-virtual! ... }; class Derived : public Base { ... }; void foo (Base* b) { delete b; } ] RESPONSE: 100754.2730@compuserve.com (Martin Aupperle) The behaviour of foo is clearly defined by the C++ language. If the dtor of Base is not virtual, then Bases's dtor is called in foo no matter what the dynamic type of the object passed to foo is. RESPONSE: clamage@Eng.Sun.COM (Steve Clamage), 5 Dec 95 Sorry, the behavior is undefined. Quoting from the draft C++ standard, section 5.3.5 "Delete", paragraph 3: "...if the static type of the operand is different from its dynamic type, the static type shall be a base class of the operand's dynamic type and the static type shall have a virtual destructor or the behavior is undefined." RESPONSE: kanze@lts.sel.alcatel.de (James Kanze), 6 Dec 95 Section 5.3.5 of the draft standard, paragraph 3: "In the first alternative (delete object), if the static type of the operand is different than the dynamic type, the static type shall have a virtual destructor or the behavior is undefined." Not unspecified, but undefined. In practice, with most (but not necessarily all) compilers, this will work as you describe as long as there is no multiple inheritance involved. In the case of multiple inheritance (and with some compilers, perhaps, also with single inheritance), the operator delete() function will get a pointer to the middle of the block. Depending on the system, and the implementation of the memory allocation algorithm, the effects can vary from the memory simply not being freed to corrupting the OS due to writing through a bad pointer. On most Unix systems, I would expect a segment violation, although not necessarily immediatly.