Skip to content

Commit 3402842

Browse files
committed
Fix increasing_allocator to conform to standard
1 parent 7111d03 commit 3402842

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

libcxx/test/std/containers/sequences/vector.bool/shrink_to_fit.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct increasing_allocator {
5555
min_elements += 1000;
5656
return std::allocator<T>{}.allocate_at_least(n);
5757
}
58-
constexpr T* allocate(std::size_t n) { return allocate_at_least(n).ptr; }
58+
constexpr T* allocate(std::size_t n) { return std::allocator<T>{}.allocate(n); }
5959
constexpr void deallocate(T* p, std::size_t n) noexcept { std::allocator<T>{}.deallocate(p, n); }
6060
};
6161

libcxx/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ struct increasing_allocator {
8787
min_elements += 1000;
8888
return std::allocator<T>{}.allocate_at_least(n);
8989
}
90-
constexpr T* allocate(std::size_t n) { return allocate_at_least(n).ptr; }
90+
constexpr T* allocate(std::size_t n) { return std::allocator<T>{}.allocate(n); }
9191
constexpr void deallocate(T* p, std::size_t n) noexcept { std::allocator<T>{}.deallocate(p, n); }
9292
};
9393

libcxx/test/std/strings/basic.string/string.capacity/shrink_to_fit.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ struct increasing_allocator {
7979
min_bytes += 1000;
8080
return {static_cast<T*>(::operator new(allocation_amount)), allocation_amount / sizeof(T)};
8181
}
82-
T* allocate(std::size_t n) { return allocate_at_least(n).ptr; }
83-
void deallocate(T* p, std::size_t) noexcept { ::operator delete(static_cast<void*>(p)); }
82+
T* allocate(std::size_t n) { return std::allocator<T>{}.allocate(n); }
83+
void deallocate(T* p, std::size_t n) noexcept { std::allocator<T>{}.deallocate(p, n); }
8484
};
8585

8686
template <typename T, typename U>

0 commit comments

Comments
 (0)