Skip to content

[libc++][test] Fix size_type issues with MinSequenceContainer and min_allocator #126267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libcxx/test/support/MinSequenceContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct MinSequenceContainer {
const_iterator cbegin() const { return const_iterator(data_.data()); }
iterator end() { return begin() + size(); }
const_iterator end() const { return begin() + size(); }
size_type size() const { return data_.size(); }
size_type size() const { return static_cast<size_type>(data_.size()); }
bool empty() const { return data_.empty(); }

void clear() { data_.clear(); }
Expand Down
10 changes: 2 additions & 8 deletions libcxx/test/support/min_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,15 +394,9 @@ class min_allocator
template <class U>
TEST_CONSTEXPR_CXX20 min_allocator(min_allocator<U>) {}

TEST_CONSTEXPR_CXX20 pointer allocate(std::ptrdiff_t n)
{
return pointer(std::allocator<T>().allocate(n));
}
TEST_CONSTEXPR_CXX20 pointer allocate(std::size_t n) { return pointer(std::allocator<T>().allocate(n)); }

TEST_CONSTEXPR_CXX20 void deallocate(pointer p, std::ptrdiff_t n)
{
std::allocator<T>().deallocate(p.ptr_, n);
}
TEST_CONSTEXPR_CXX20 void deallocate(pointer p, std::size_t n) { std::allocator<T>().deallocate(p.ptr_, n); }

TEST_CONSTEXPR_CXX20 friend bool operator==(min_allocator, min_allocator) {return true;}
TEST_CONSTEXPR_CXX20 friend bool operator!=(min_allocator x, min_allocator y) {return !(x == y);}
Expand Down