Title
Consistency with mismatched aligned/non-over-aligned allocation/deallocation functions
Status
c++20
Section
7.6.2.8 [expr.new]
Submitter
Richard Smith

Created on 2016-06-27.00:00:00 last changed 48 months ago

Messages

Date: 2019-09-15.00:00:00

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 if the allocated object type has new-extended alignment, the alignment argument is removed from the argument list,;

  • otherwise, an argument list that is the type's alignment and has type std::align_val_t is added into the argument list immediately after the first argument;

and then overload resolution is performed again.

Date: 2019-11-15.00:00:00

[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.

History
Date User Action Args
2020-12-15 00:00:00adminsetmessages: + msg6440
2020-12-15 00:00:00adminsetstatus: drafting -> c++20
2016-06-27 00:00:00admincreate