Allocation in core constant expressions
7.7 [expr.const]
Davis Herring

Created on 2019-08-28.00:00:00 last changed 20 months ago


Date: 2019-08-28.00:00:00

7.7 [expr.const] paragraph 5 attempts to describe allowable allocation/deallocation calls in terms of what could be called “core constant subexpressions,” but the actual definition of a core constant expression in paragraph 4 is in terms of evaluation.

Suggested resolution:

Replace the entirety of 7.7 [expr.const] paragraph 5 with the following:

For the purposes of determining whether an expression is a core constant expression, the execution of the body of a member function of std::allocator<T> as defined in [allocator.members], where T is a literal type, is ignored. Similarly, the execution of the body of std::destroy_at, std::ranges::destroy_at, std::construct_at, or std::ranges::construct_at is considered to include only the underlying constructor (for the functions construct_at) or destructor (for the functions destroy_at) call if the first argument (of type T*) points to storage allocated with std::allocator<T>).
Date User Action Args
2019-08-28 00:00:00admincreate