llvm-project/libcxx/include/experimental
Mikhail Maltsev be10b1f1cc [libcxx] Make allocator<T>:allocate throw bad_array_new_length
Currently the member functions std::allocator<T>::allocate,
std::experimental::pmr::polymorphic_allocator::allocate and
std::resource_adaptor<T>::do_allocate throw an exception of type
std::length_error when the requested size exceeds the maximum size.

According to the C++ standard ([allocator.members]/4,
[mem.poly.allocator.mem]/1), std::allocator<T>::allocate and
std::pmr::polymorphic_allocator::allocate must throw a
std::bad_array_new_length exception in this case.

The patch fixes the issue with std::allocator<T>::allocate and changes
the type the exception thrown by
std::experimental::pmr::resource_adaptor<T>::do_allocate to
std::bad_array_new_length as well for consistency.

The patch resolves LWG 3237, LWG 3038 and LWG 3190.

Reviewed By: ldionne, #libc, Quuxplusone

Differential Revision: https://reviews.llvm.org/D110846
2021-10-18 19:12:42 +01:00
..
__config [libc++] Fix some typos and remove unused macros. NFCI. 2021-04-22 12:02:22 -04:00
__memory [libcxx][functional][modular] splices <functional> into modular headers 2021-07-01 14:01:49 -04:00
algorithm [libc++][NFC] Remove useless _LIBCPP_PUSH_MACROS 2021-08-27 12:41:55 -04:00
coroutine [libcxx] Do not implicitly #include assert.h 2019-09-26 11:12:29 +00:00
deque
filesystem
forward_list
functional [libcxx][functional][modular] splices <functional> into modular headers 2021-07-01 14:01:49 -04:00
iterator [libcxx][modularisation] moves <utility> content out of <type_traits> 2021-06-24 17:57:29 +00:00
list
map
memory_resource [libcxx] Make allocator<T>:allocate throw bad_array_new_length 2021-10-18 19:12:42 +01:00
propagate_const [libc++] s/_VSTD::declval/declval/g. NFCI. 2021-05-11 12:23:55 -04:00
regex [libc++] Add an option to disable wide character support in libc++ 2021-10-12 06:08:23 -04:00
set
simd [libc++][NFCI] Remove uses of _LIBCPP_INLINE_VAR 2021-09-22 16:03:00 -04:00
string [libc++] Add an option to disable wide character support in libc++ 2021-10-12 06:08:23 -04:00
type_traits [libc++] Remove more unnecessary _VSTD:: from type names. NFCI. 2021-05-11 12:23:55 -04:00
unordered_map
unordered_set
utility
vector