[all-commits] [llvm/llvm-project] 05a2d1: [libcxx] Throw correct exception from std::vector:...
Mikhail Maltsev via All-commits
all-commits at lists.llvm.org
Thu Oct 21 02:41:25 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 05a2d1766864f60210d8f337a7ea709fa0707b53
https://github.com/llvm/llvm-project/commit/05a2d1766864f60210d8f337a7ea709fa0707b53
Author: Mikhail Maltsev <mikhail.maltsev at arm.com>
Date: 2021-10-21 (Thu, 21 Oct 2021)
Changed paths:
M libcxx/include/vector
M libcxx/test/std/containers/sequences/vector.bool/reserve.pass.cpp
M libcxx/test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp
Log Message:
-----------
[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
More information about the All-commits
mailing list