From 4044fbee867f739ad28f705bbcae01259e704381 Mon Sep 17 00:00:00 2001 From: Peng Liu Date: Sun, 10 Nov 2024 17:13:54 -0500 Subject: [PATCH] Fix increasing_allocator to conform to standard --- .../containers/sequences/vector.bool/shrink_to_fit.pass.cpp | 2 +- .../sequences/vector/vector.capacity/shrink_to_fit.pass.cpp | 2 +- .../basic.string/string.capacity/shrink_to_fit.pass.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libcxx/test/std/containers/sequences/vector.bool/shrink_to_fit.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/shrink_to_fit.pass.cpp index f8bcee31964bbb..136b151efa29ef 100644 --- a/libcxx/test/std/containers/sequences/vector.bool/shrink_to_fit.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/shrink_to_fit.pass.cpp @@ -55,7 +55,7 @@ struct increasing_allocator { min_elements += 1000; return std::allocator{}.allocate_at_least(n); } - constexpr T* allocate(std::size_t n) { return allocate_at_least(n).ptr; } + constexpr T* allocate(std::size_t n) { return std::allocator{}.allocate(n); } constexpr void deallocate(T* p, std::size_t n) noexcept { std::allocator{}.deallocate(p, n); } }; 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 e39afb2d48f0a0..97d67dac2baa8c 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 @@ -87,7 +87,7 @@ struct increasing_allocator { min_elements += 1000; return std::allocator{}.allocate_at_least(n); } - constexpr T* allocate(std::size_t n) { return allocate_at_least(n).ptr; } + constexpr T* allocate(std::size_t n) { return std::allocator{}.allocate(n); } constexpr void deallocate(T* p, std::size_t n) noexcept { std::allocator{}.deallocate(p, n); } }; diff --git a/libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp index 6f5e43d1341f53..68360329308bab 100644 --- a/libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp +++ b/libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp @@ -79,8 +79,8 @@ struct increasing_allocator { min_bytes += 1000; 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)); } + T* allocate(std::size_t n) { return std::allocator{}.allocate(n); } + void deallocate(T* p, std::size_t) noexcept { std::allocator{}.deallocate(p, n); } }; template