llvm-project/libcxx/test/std/utilities/memory/default.allocator
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
..
allocator.globals [libc++] Implement C++20's P0784 (More constexpr containers) 2020-09-22 11:20:33 -04:00
allocator.members [libcxx] Make allocator<T>:allocate throw bad_array_new_length 2021-10-18 19:12:42 +01:00
PR50299.compile.pass.cpp [libc++] Undeprecate the std::allocator<void> specialization 2021-06-16 09:54:29 -04:00
allocator.ctor.pass.cpp [libc++] Undeprecate the std::allocator<void> specialization 2021-06-16 09:54:29 -04:00
allocator.dtor.pass.cpp [libc++] Undeprecate the std::allocator<void> specialization 2021-06-16 09:54:29 -04:00
allocator_pointers.pass.cpp [libc++] Undeprecate the std::allocator<void> specialization 2021-06-16 09:54:29 -04:00
allocator_types.deprecated_in_cxx17.verify.cpp [libc++] Remove test-suite annotations for unsupported Clang versions 2021-08-20 15:05:13 -04:00
allocator_types.pass.cpp [libc++] Undeprecate the std::allocator<void> specialization 2021-06-16 09:54:29 -04:00
allocator_types.removed_in_cxx20.verify.cpp [libc++] Undeprecate the std::allocator<void> specialization 2021-06-16 09:54:29 -04:00
allocator_types.void.compile.pass.cpp [libc++] Undeprecate the std::allocator<void> specialization 2021-06-16 09:54:29 -04:00