diff --git a/libcxx/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp index d0bdf4fddc2251..a2f0900cf8110d 100644 --- a/libcxx/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp @@ -85,7 +85,7 @@ struct increasing_allocator { if (allocation_amount < min_bytes) allocation_amount = min_bytes; min_bytes += 1000; - return {static_cast(::operator new(allocation_amount)), allocation_amount}; + return {static_cast(::operator new(allocation_amount)), allocation_amount/sizeof(T)}; } T* allocate(std::size_t n) { return allocate_at_least(n).ptr; } void deallocate(T* p, std::size_t) noexcept { ::operator delete(static_cast(p)); } @@ -103,7 +103,7 @@ void test_increasing_allocator() { assert(is_contiguous_container_asan_correct(v)); std::size_t capacity = v.capacity(); v.shrink_to_fit(); - assert(v.capacity() == capacity); + assert(v.capacity() <= capacity); assert(v.size() == 1); assert(is_contiguous_container_asan_correct(v)); }