This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2026-03-27


3157. Missing handling of operator new[] for deallocation function template matching

Section: 13.10.3.7  [temp.deduct.decl]     Status: ready     Submitter: Jiang An     Date: 2026-01-26

(From submission #838.)

Subclause 13.10.3.7 [temp.deduct.decl] paragraph 1 does not handle array-new.

Proposed resolution (approved by CWG 2026-02-20):

  1. Change in 13.10.3.7 [temp.deduct.decl] paragraph 1 as follows:

    In a declaration whose declarator-id refers to a specialization of a function template, template argument deduction is performed to identify the specialization to which the declaration refers. Specifically, this is done for explicit instantiations (13.9.3 [temp.explicit]), explicit specializations (13.9.4 [temp.expl.spec]), and certain friend declarations (13.7.5 [temp.friend]). This is also done to determine whether a deallocation function template specialization matches a placement operator new allocation function (6.8.6.5.3 [basic.stc.dynamic.deallocation], 7.6.2.8 [expr.new]). In all these cases, P is the type of the function template being considered as a potential match and A is either the function type from the declaration or the type of the deallocation function that would match the placement operator new allocation function as described in 7.6.2.8 [expr.new]. The deduction is done as described in 13.10.3.6 [temp.deduct.type].
  2. Change in 13.7.7.3 [temp.func.order] bullet 1.3 as follows:

    • ...
    • when a placement operator delete deallocation function that is a function template specialization is selected to match a placement operator new allocation function (6.8.6.5.3 [basic.stc.dynamic.deallocation], 7.6.2.8 [expr.new]);
    • ...