Title
Contradictory results of failed destructor lookup
Status
drafting
Section
11.4.7 [class.dtor]
Submitter
Gabriel Dos Reis

Created on 2014-07-21.00:00:00 last changed 126 months ago

Messages

Date: 2022-02-18.07:47:23

According to 11.4.7 [class.dtor] paragraph 12,

At the point of definition of a virtual destructor (including an implicit definition (11.4.5.3 [class.copy.ctor])), the non-array deallocation function is looked up in the scope of the destructor's class (6.5.2 [class.member.lookup]), and, if no declaration is found, the function is looked up in the global scope. If the result of this lookup is ambiguous or inaccessible, or if the lookup selects a placement deallocation function or a function with a deleted definition (9.5 [dcl.fct.def]), the program is ill-formed. [Note: This assures that a deallocation function corresponding to the dynamic type of an object is available for the delete-expression (11.4.11 [class.free]). —end note]

However, bullet 5.3 of that section says that such a lookup failure causes the destructor to be defined as deleted, rather than making the program ill-formed. It appears that paragraph 12 was overlooked when deleted functions were added to the language. See also 11.4.11 [class.free] paragraph 7.

History
Date User Action Args
2014-07-21 00:00:00admincreate