Created on 2022-03-22.00:00:00 last changed 30 months ago
Proposed resolution:
This wording is relative to N4910.
Modify [allocator.members] as indicated:
[[nodiscard]] constexpr allocation_result<T*> allocate_at_least(size_t n);-6- Mandates: T is not an incomplete type ([basic.types.general]).
-7- Returns: allocation_result<T*>{ptr, count}, where ptr is a pointer to the initial element of an array of count T and count ≥ n. -8- Throws: bad_array_new_length if numeric_limits<size_t>::max() / sizeof(T) < n, or bad_alloc if the storage cannot be obtained. -9- Remarks: The storage for the array is obtained by calling ::operator new, but it is unspecified when or how often this function is called. This function starts the lifetime of the array object, but not that of any of the array elements. This function returns allocation_result<T*>{allocate(n), n} within the evaluation of a core constant expression.
[ 2022-05-17; Reflector poll ]
Set priority to 3 after reflector poll. Suggestion to fix this in Core instead.
std::allocator<T>::allocate_at_least is a constexpr function that allocates memory during constant evaluation, but its restrictions is not clear. Presumably the restrictions are same as those of std::allocator<T>::allocate, and we should specify allocate_at_least in term of allocate.
The MSVC STL implementation returns allocation_result<T*>{allocate(n), n} now. Perhaps we should adopt this strategy for constant evaluation to avoid additional mechanism in the compiler.History | |||
---|---|---|---|
Date | User | Action | Args |
2022-05-17 11:58:16 | admin | set | messages: + msg12458 |
2022-03-26 11:31:30 | admin | set | messages: + msg12409 |
2022-03-22 00:00:00 | admin | create |