Skip to content

Commit 15bfb29

Browse files
[libc++][test] Fix size_type issues with MinSequenceContainer...
... and `min_allocator`
1 parent 3f8e280 commit 15bfb29

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

libcxx/test/support/MinSequenceContainer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct MinSequenceContainer {
3131
const_iterator cbegin() const { return const_iterator(data_.data()); }
3232
iterator end() { return begin() + size(); }
3333
const_iterator end() const { return begin() + size(); }
34-
size_type size() const { return data_.size(); }
34+
size_type size() const { return static_cast<size_type>(data_.size()); }
3535
bool empty() const { return data_.empty(); }
3636

3737
void clear() { data_.clear(); }

libcxx/test/support/min_allocator.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -394,15 +394,9 @@ class min_allocator
394394
template <class U>
395395
TEST_CONSTEXPR_CXX20 min_allocator(min_allocator<U>) {}
396396

397-
TEST_CONSTEXPR_CXX20 pointer allocate(std::ptrdiff_t n)
398-
{
399-
return pointer(std::allocator<T>().allocate(n));
400-
}
397+
TEST_CONSTEXPR_CXX20 pointer allocate(std::size_t n) { return pointer(std::allocator<T>().allocate(n)); }
401398

402-
TEST_CONSTEXPR_CXX20 void deallocate(pointer p, std::ptrdiff_t n)
403-
{
404-
std::allocator<T>().deallocate(p.ptr_, n);
405-
}
399+
TEST_CONSTEXPR_CXX20 void deallocate(pointer p, std::size_t n) { std::allocator<T>().deallocate(p.ptr_, n); }
406400

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

0 commit comments

Comments
 (0)