This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 114a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-04-18


1783. Why are virtual destructors non-trivial?

Section: 11.4.7  [class.dtor]     Status: NAD     Submitter: Jeffrey Yasskin     Date: 2013-09-26

According to 11.4.7 [class.dtor] paragraph 5,

A destructor is trivial if it is not user-provided and if:

It is not clear why this restriction is needed, and it should be removed if it is not needed.

Rationale (February, 2014):

A trivial destructor is known to perform no actions and thus need not be invoked. A virtual destructor, however, might be member of a base class of an unknown derived class; it must therefore be called virtually in case an overriding virtual function performs some actions.