Title
Lookup of deallocation function in a virtual destructor definition
Status
cd4
Section
11.4.7 [class.dtor]
Submitter
Richard Smith

Created on 2013-11-18.00:00:00 last changed 49 months ago

Messages

Date: 2014-11-15.00:00:00

[Moved to DR at the November, 2014 meeting.]

Date: 2014-02-15.00:00:00

Proposed resolution (February, 2014):

Change 11.4.7 [class.dtor] paragraph 12 as follows:

At the point of definition of a virtual destructor (including an implicit definition (_N4750_.15.8 [class.copy])), 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 determined as if for the expression delete this appearing in a non-virtual destructor of the destructor's class (see 7.6.2.9 [expr.delete]). If the result of this lookup is ambiguous or inaccessible, lookup fails or if the lookup selects a placement deallocation function or a function with deallocation function has 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.11 [class.free]). —end note]
Date: 2020-12-15.00:00:00

According to 11.4.7 [class.dtor] paragraph 12,

At the point of definition of a virtual destructor (including an implicit definition (_N4750_.15.8 [class.copy])), 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.11 [class.free]). —end note]

This specification is not sufficiently clear regarding the nature of the lookup. Presumably the intent is that the processing be parallel to that described in 7.6.2.9 [expr.delete], but that should be made explicit.

History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: drwp -> cd4
2015-05-25 00:00:00adminsetstatus: dr -> drwp
2015-04-13 00:00:00adminsetmessages: + msg5397
2014-11-24 00:00:00adminsetstatus: tentatively ready -> dr
2014-03-03 00:00:00adminsetmessages: + msg4860
2014-03-03 00:00:00adminsetstatus: open -> tentatively ready
2013-11-18 00:00:00admincreate