llvm-project/libcxx/test/std/containers/sequences/vector/vector.capacity
Mikhail Maltsev 05a2d17668 [libcxx] Throw correct exception from std::vector::reserve
According to the standard [vector.capacity]/5, std::vector<T>::reserve
shall throw an exception of type std::length_error when the requested
capacity exceeds max_size().

This behavior is not implemented correctly: the function 'reserve'
simply propagates the exception from allocator<T>::allocate. Before
D110846 that exception used to be of type std::length_error (which is
correct for vector<T>::reserve, but incorrect for
allocator<T>::allocate).

This patch fixes the issue and adds regression tests.

Reviewed By: Quuxplusone, ldionne, #libc

Differential Revision: https://reviews.llvm.org/D112068
2021-10-21 10:40:48 +01:00
..
capacity.pass.cpp
empty.pass.cpp
empty.verify.cpp
max_size.pass.cpp
reserve.pass.cpp [libcxx] Throw correct exception from std::vector::reserve 2021-10-21 10:40:48 +01:00
resize_size.pass.cpp
resize_size_value.pass.cpp
shrink_to_fit.pass.cpp [NFC][libc++] Use TEST_HAS_NO_EXCEPTIONS in tests. 2021-10-02 13:47:27 +02:00
size.pass.cpp
swap.pass.cpp