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


127. Ambiguity in description of matching deallocation function

Section: 7.6.2.8  [expr.new]     Status: TC1     Submitter: Alexander Schiemann     Date: 8 June 1999

If a placement allocation function has default arguments for all its parameters except the first, it can be called using non-placement syntax. In such a case, it is not clear whether the deallocation function to be called if the constructor terminates by throwing an expression is determined on the basis of the syntax of the new-expression (i.e., a non-placement deallocation function) or the declaration of the selected (placement) allocation function. 7.6.2.8 [expr.new] paragraph 19 indicates that the deallocation function must match the declaration of the allocation function. However, 14.3 [except.ctor] says that the distinction is based on whether the new-expression contains a new-placement or not.

Proposed resolution (10/00):

In 14.3 [except.ctor] paragraph 2, replace

If the object or array was allocated in a new-expression and the new-expression does not contain a new-placement, the deallocation function (6.7.5.5.3 [basic.stc.dynamic.deallocation], 11.4.11 [class.free]) is called to free the storage occupied by the object; the deallocation function is chosen as specified in 7.6.2.8 [expr.new]. If the object or array was allocated in a new-expression and the new-expression contains a new-placement, the storage occupied by the object is deallocated only if an appropriate placement operator delete is found, as specified in 7.6.2.8 [expr.new].

with

If the object or array was allocated in a new-expression, the matching deallocation function (6.7.5.5.3 [basic.stc.dynamic.deallocation], 7.6.2.8 [expr.new], 11.4.11 [class.free]), if any, is called to free the storage occupied by the object.

See also issue 429.