Skip to content
Closed

Stl fixes #132159

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
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ TEST_CONSTEXPR_CXX26 void test() {
vec[5] = 6;
getGlobalMemCounter()->throw_after = 0;
std::stable_partition(
forward_iterator<int*>(vec.data()), forward_iterator<int*>(vec.data() + vec.size()), [](int i) {
bidirectional_iterator<int*>(vec.data()), bidirectional_iterator<int*>(vec.data() + vec.size()), [](int i) {
return i < 5;
});
assert(std::is_partitioned(vec.begin(), vec.end(), [](int i) { return i < 5; }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
types::for_each(types::forward_iterator_list<int*>(), TestIter());

#if TEST_STD_VER >= 11
if (TEST_STD_VER >= 23 || !TEST_IS_CONSTANT_EVALUATED)
if (TEST_STD_AT_LEAST_23_OR_RUNTIME_EVALUATED)
types::for_each(types::forward_iterator_list<std::unique_ptr<int>*>(), TestUniquePtr());
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ TEST_CONSTEXPR_CXX20 bool test() {

#if TEST_STD_VER >= 11
// We can't test unique_ptr in constant evaluation before C++23 as it's constexpr only since C++23.
if (TEST_STD_VER >= 23 || !TEST_IS_CONSTANT_EVALUATED)
if (TEST_STD_AT_LEAST_23_OR_RUNTIME_EVALUATED)
types::for_each(types::forward_iterator_list<std::unique_ptr<int>*>(), TestUniquePtr());
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,9 @@ TEST_CONSTEXPR_CXX26 bool test() {
std::sort(ia, ia + M, indirect_less());
std::sort(ia + M, ia + N, indirect_less());
std::inplace_merge(ia, ia + M, ia + N, indirect_less());
if (N > 0) {
assert(*ia[0] == 0);
assert(*ia[N - 1] == N - 1);
assert(std::is_sorted(ia, ia + N, indirect_less()));
}
assert(*ia[0] == 0);
assert(*ia[N - 1] == N - 1);
assert(std::is_sorted(ia, ia + N, indirect_less()));
delete[] ia;
}
#endif // TEST_STD_VER >= 11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
//
//===----------------------------------------------------------------------===//

// REQUIRES: has-unix-headers, libcpp-has-abi-bounded-iterators-in-std-array
// REQUIRES: has-unix-headers
// REQUIRES: libcpp-has-abi-bounded-iterators-in-std-array
// UNSUPPORTED: c++03
// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ TEST_CONSTEXPR_CXX20 bool tests() {
// Test with various allocators and different `size_type`s
{
test(std::vector<bool>());
test(std::vector<bool, std::allocator<int> >());
test(std::vector<bool, std::allocator<bool> >());
test(std::vector<bool, min_allocator<bool> >());
test(std::vector<bool, test_allocator<bool> >(test_allocator<bool>(1)));
test(std::vector<bool, other_allocator<bool> >(other_allocator<bool>(5)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
// the insertion point remain valid but those at or after the insertion point,
// including the past-the-end iterator, are invalidated.

// REQUIRES: has-unix-headers, libcpp-has-abi-bounded-iterators-in-vector
// REQUIRES: has-unix-headers
// REQUIRES: libcpp-has-abi-bounded-iterators-in-vector
// UNSUPPORTED: c++03
// UNSUPPORTED: libcpp-hardening-mode=none
// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void test_tellg(std::streamoff total_size) {
ofs.open(p, std::ios::out | std::ios::binary);
assert(ofs.is_open());
for (std::streamoff size = 0; size < total_size;) {
std::size_t n = std::min(static_cast<std::streamoff>(data.size()), total_size - size);
std::streamoff n = std::min(static_cast<std::streamoff>(data.size()), total_size - size);
ofs.write(data.data(), n);
size += n;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
// UNSUPPORTED: no-filesystem
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME

// XFAIL: msvc, target={{.+}}-windows-gnu
// XFAIL: msvc
// XFAIL: target={{.+}}-windows-gnu
// XFAIL: availability-fp_to_chars-missing

// fmemopen is available starting in Android M (API 23)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ constexpr struct {
{36, 18, 18},
{25, 30, 5},
{24, 16, 8},
{128, 100, 4}};
{124, 100, 4}};

template <typename Input1, typename Input2, typename Output>
constexpr bool test0(int in1, int in2, int out)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
#include "test_macros.h"

// class utc_clock
using rep = std::chrono::utc_clock::rep;
using period = std::chrono::utc_clock::period;
using duration = std::chrono::utc_clock::duration;
using time_point = std::chrono::utc_clock::time_point;
constexpr bool is_steady = std::chrono::utc_clock::is_steady;
using rep = std::chrono::utc_clock::rep;
using period = std::chrono::utc_clock::period;
using duration = std::chrono::utc_clock::duration;
using time_point = std::chrono::utc_clock::time_point;
[[maybe_unused]] constexpr bool is_steady = std::chrono::utc_clock::is_steady;

// Tests the values. Some of them are implementation-defined.
LIBCPP_STATIC_ASSERT(std::same_as<rep, std::chrono::system_clock::rep>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
static_assert(noexcept(std::swap(ma, ma)), "");
}

if (TEST_STD_VER >= 23 || !TEST_IS_CONSTANT_EVALUATED)
if (TEST_STD_AT_LEAST_23_OR_RUNTIME_EVALUATED)
test_unique_ptr();
#endif

Expand Down
2 changes: 1 addition & 1 deletion libcxx/test/support/min_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ struct tiny_size_allocator {

template <class U>
struct rebind {
using other = tiny_size_allocator<MaxSize, T>;
using other = tiny_size_allocator<MaxSize, U>;
};

tiny_size_allocator() = default;
Expand Down
6 changes: 4 additions & 2 deletions libcxx/test/support/sized_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ class sized_allocator {
TEST_CONSTEXPR_CXX20 T* allocate(size_type n) {
if (n > max_size())
TEST_THROW(std::bad_array_new_length());
return std::allocator<T>().allocate(n);
return std::allocator<T>().allocate(static_cast<std::size_t>(n));
}

TEST_CONSTEXPR_CXX20 void deallocate(T* p, size_type n) TEST_NOEXCEPT { std::allocator<T>().deallocate(p, n); }
TEST_CONSTEXPR_CXX20 void deallocate(T* p, size_type n) TEST_NOEXCEPT {
std::allocator<T>().deallocate(p, static_cast<std::size_t>(n));
}

TEST_CONSTEXPR size_type max_size() const TEST_NOEXCEPT {
return std::numeric_limits<size_type>::max() / sizeof(value_type);
Expand Down
Loading