This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.
std::allocator<void>().allocate(n)
Section: 20.2.10 [default.allocator] Status: C++20 Submitter: Jonathan Wakely Opened: 2019-10-25 Last modified: 2021-02-25
Priority: 0
View other active issues in [default.allocator].
View all other issues in [default.allocator].
View all issues with C++20 status.
Discussion:
In C++20 the std::allocator<void>
explicit specialization is gone, which means it uses the
primary template, which has allocate and deallocate members.
sizeof(T)
, std::allocator<T>::allocate
doesn't have an explicit precondition that the value type is complete.
[2019-11 Status to 'Ready' in Monday issue prioritization in Belfast]
Proposed resolution:
This wording is relative to N4835.
Modify 20.2.10.2 [allocator.members] as indicated:
[[nodiscard]] constexpr T* allocate(size_t n);-?- Mandates:
-2- Returns: A pointer to the initial element of an array of storage of sizeT
is not an incomplete type (6.8 [basic.types]).n * sizeof(T)
, aligned appropriately for objects of typeT
. […]