This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-12-20
[Voted into the WP at the September, 2008 meeting.]
Deallocation functions can't be virtual because they are staticmember functions; however, according to 11.4.11 [class.free] paragraph 7, they behave like virtual functions when the class'sdestructor is virtual:
Since member allocation and deallocation functions arestaticthey cannot be virtual. [Note: however, whenthecast-expression of adelete-expression refers to anobject of class type, because the deallocation function actuallycalled is looked up in the scope of the class that is the dynamic typeof the object, if the destructor is virtual, the effect is the same.
Because the intent is to make any use of a deleted functiondiagnosable at compile time, a virtual deleted function can neitheroverride nor be overridden by a non-deleted function, as describedin 11.7.3 [class.virtual] paragraph 14:
A function with a deleted definition (9.6 [dcl.fct.def]) shallnot override a function that does not have a deleteddefinition. Likewise, a function that does not have a deleteddefinition shall not override a function with a deleted definition.
One would assume that a similar kind of prohibition is needed fordeallocation functions in a class hierarchy with virtual destructors,but it's not clear that the current specification says that.9.6 [dcl.fct.def] paragraph 10 says,
A program that refers to a deleted function implicitly or explicitly,other than to declare it, is ill-formed.
Furthermore, the deallocation function is looked up at the pointof definition of a virtual destructor (11.4.7 [class.dtor] paragraph 11), and the function found by this lookup is consideredto be “used” (6.3 [basic.def.odr] paragraph 2).However, it's not completely clear that this “use”constitutes a “reference” in the sense of9.6 [dcl.fct.def] paragraph 10, especially in a program inwhich an object of a type that would call that deallocation functionis never deleted.
Suggested resolution:Augment the list of lookup results from a virtual destructor thatrender a program ill-formed in 11.4.7 [class.dtor] paragraph 10to include a deleted function:
If the result of this lookup is ambiguous or inaccessible, or if thelookup selects a placement deallocation functionor a function witha deleted definition (9.6 [dcl.fct.def]), the program isill-formed.
Proposed resolution (June, 2008):
Change 11.4.7 [class.dtor] paragraph 10 as follows:
If the result of this lookup is ambiguous or inaccessible, or if thelookup selects a placement deallocation functionor a function witha deleted definition (9.6 [dcl.fct.def]), the program isill-formed.