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

2024-03-20


2282. Consistency with mismatched aligned/non-over-aligned allocation/deallocation functions

Section: 7.6.2.8  [expr.new]     Status: C++20     Submitter: Richard Smith     Date: 2016-06-27

[Adopted as a DR at the November, 2019 meeting.]

The fallback treatment for alignment and non-alignment allocation and deallocation functions is asymmetric. While a deletion of a non-overaligned class object will match a class-specific alignment deallocation function if no class-specific non-alignment deallocation function is provided, the same is not true for allocation: a new-expression for a non-overaligned class type will fail if an alignment allocation function is provided with no non-alignment allocation function. The allocation behavior should be changed to match the deallocation behavior.

Proposed resolution (September, 2019):

Change 7.6.2.8 [expr.new] paragraph 18 as follows, splitting the running text into bullets:

Overload resolution is performed on a function call created by assembling an argument list. The first argument is the amount of space requested, and has type std::size_t. If the type of the allocated object has new-extended alignment, the next argument is the type's alignment, and has type std::align_val_t. If the new-placement syntax is used, the initializer-clauses in its expression-list are the succeeding arguments. If no matching function is found then

and then overload resolution is performed again.