Title
Why are virtual destructors non-trivial?
Status
nad
Section
11.4.7 [class.dtor]
Submitter
Jeffrey Yasskin

Created on 2013-09-26.00:00:00 last changed 131 months ago

Messages

Date: 2014-02-15.00:00:00

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.

Date: 2022-11-20.07:54:16

According to 11.4.7 [class.dtor] paragraph 5,

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

  • the destructor is not virtual,

  • ...

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

History
Date User Action Args
2014-03-03 00:00:00adminsetmessages: + msg4980
2014-03-03 00:00:00adminsetstatus: open -> nad
2013-09-26 00:00:00admincreate