Skip to content

Commit a6ee161

Browse files
committed
Use standard std::equal in fill/fill_n tests due to #126369
1 parent f653b87 commit a6ee161

File tree

4 files changed

+64
-8
lines changed

4 files changed

+64
-8
lines changed

libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,28 @@ TEST_CONSTEXPR_CXX20 void test_bititer_with_custom_sized_types() {
5555
std::vector<bool, Alloc> in(100, false, Alloc(1));
5656
std::vector<bool, Alloc> expected(100, true, Alloc(1));
5757
std::fill(in.begin(), in.end(), true);
58-
assert(in == expected);
58+
59+
// FIXME: We are currently forced to use the standard `std::equal()` for general `input_iterator`s instead of
60+
// the optimized version for `__bit_iterator`s. This is due to a recently discovered issue #126369 where the
61+
// optimization fails to correctly compare `vector<bool>`s with small integral storage types. Once the issue is
62+
// fixed, we should revert to the optimized version by uncommenting the last line in this code block.
63+
using It = cpp17_input_iterator<std::vector<bool, Alloc>::iterator>;
64+
assert(in.size() == expected.size() && std::equal(It(in.begin()), It(in.end()), It(expected.begin())));
65+
// assert(in == expected); // FIXME: Uncomment this line once issue #126369 is fixed.
5966
}
6067
{
6168
using Alloc = sized_allocator<bool, std::uint16_t, std::int16_t>;
6269
std::vector<bool, Alloc> in(200, false, Alloc(1));
6370
std::vector<bool, Alloc> expected(200, true, Alloc(1));
6471
std::fill(in.begin(), in.end(), true);
65-
assert(in == expected);
72+
73+
// FIXME: We are currently forced to use the standard `std::equal()` for general `input_iterator`s instead of
74+
// the optimized version for `__bit_iterator`s. This is due to a recently discovered issue #126369 where the
75+
// optimization fails to correctly compare `vector<bool>`s with small integral storage types. Once the issue is
76+
// fixed, we should revert to the optimized version by uncommenting the last line in this code block.
77+
using It = cpp17_input_iterator<std::vector<bool, Alloc>::iterator>;
78+
assert(in.size() == expected.size() && std::equal(It(in.begin()), It(in.end()), It(expected.begin())));
79+
// assert(in == expected); // FIXME: Uncomment this line once issue #126369 is fixed.
6680
}
6781
{
6882
using Alloc = sized_allocator<bool, std::uint32_t, std::int32_t>;

libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,28 @@ TEST_CONSTEXPR_CXX20 void test_bititer_with_custom_sized_types() {
137137
std::vector<bool, Alloc> in(100, false, Alloc(1));
138138
std::vector<bool, Alloc> expected(100, true, Alloc(1));
139139
std::fill_n(in.begin(), in.size(), true);
140-
assert(in == expected);
140+
141+
// FIXME: We are currently forced to use the standard `std::equal()` for general `input_iterator`s instead of
142+
// the optimized version for `__bit_iterator`s. This is due to a recently discovered issue #126369 where the
143+
// optimization fails to correctly compare `vector<bool>`s with small integral storage types. Once the issue is
144+
// fixed, we should revert to the optimized version by uncommenting the last line in this code block.
145+
using It = cpp17_input_iterator<std::vector<bool, Alloc>::iterator>;
146+
assert(in.size() == expected.size() && std::equal(It(in.begin()), It(in.end()), It(expected.begin())));
147+
// assert(in == expected); // FIXME: Uncomment this line once issue #126369 is fixed.
141148
}
142149
{
143150
using Alloc = sized_allocator<bool, std::uint16_t, std::int16_t>;
144151
std::vector<bool, Alloc> in(200, false, Alloc(1));
145152
std::vector<bool, Alloc> expected(200, true, Alloc(1));
146153
std::fill_n(in.begin(), in.size(), true);
147-
assert(in == expected);
154+
155+
// FIXME: We are currently forced to use the standard `std::equal()` for general `input_iterator`s instead of
156+
// the optimized version for `__bit_iterator`s. This is due to a recently discovered issue #126369 where the
157+
// optimization fails to correctly compare `vector<bool>`s with small integral storage types. Once the issue is
158+
// fixed, we should revert to the optimized version by uncommenting the last line in this code block.
159+
using It = cpp17_input_iterator<std::vector<bool, Alloc>::iterator>;
160+
assert(in.size() == expected.size() && std::equal(It(in.begin()), It(in.end()), It(expected.begin())));
161+
// assert(in == expected); // FIXME: Uncomment this line once issue #126369 is fixed.
148162
}
149163
{
150164
using Alloc = sized_allocator<bool, std::uint32_t, std::int32_t>;

libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/ranges.fill.pass.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,28 @@ TEST_CONSTEXPR_CXX20 void test_bititer_with_custom_sized_types() {
9191
std::vector<bool, Alloc> in(100, false, Alloc(1));
9292
std::vector<bool, Alloc> expected(100, true, Alloc(1));
9393
std::ranges::fill(in, true);
94-
assert(in == expected);
94+
95+
// FIXME: We are currently forced to use the standard `std::equal()` for general `input_iterator`s instead of
96+
// the optimized version for `__bit_iterator`s. This is due to a recently discovered issue #126369 where the
97+
// optimization fails to correctly compare `vector<bool>`s with small integral storage types. Once the issue is
98+
// fixed, we should revert to the optimized version by uncommenting the last line in this code block.
99+
using It = cpp17_input_iterator<std::vector<bool, Alloc>::iterator>;
100+
assert(in.size() == expected.size() && std::equal(It(in.begin()), It(in.end()), It(expected.begin())));
101+
// assert(in == expected); // FIXME: Uncomment this line once issue #126369 is fixed.
95102
}
96103
{
97104
using Alloc = sized_allocator<bool, std::uint16_t, std::int16_t>;
98105
std::vector<bool, Alloc> in(200, false, Alloc(1));
99106
std::vector<bool, Alloc> expected(200, true, Alloc(1));
100107
std::ranges::fill(in, true);
101-
assert(in == expected);
108+
109+
// FIXME: We are currently forced to use the standard `std::equal()` for general `input_iterator`s instead of
110+
// the optimized version for `__bit_iterator`s. This is due to a recently discovered issue #126369 where the
111+
// optimization fails to correctly compare `vector<bool>`s with small integral storage types. Once the issue is
112+
// fixed, we should revert to the optimized version by uncommenting the last line in this code block.
113+
using It = cpp17_input_iterator<std::vector<bool, Alloc>::iterator>;
114+
assert(in.size() == expected.size() && std::equal(It(in.begin()), It(in.end()), It(expected.begin())));
115+
// assert(in == expected); // FIXME: Uncomment this line once issue #126369 is fixed.
102116
}
103117
{
104118
using Alloc = sized_allocator<bool, std::uint32_t, std::int32_t>;

libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/ranges.fill_n.pass.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,28 @@ TEST_CONSTEXPR_CXX20 void test_bititer_with_custom_sized_types() {
6464
std::vector<bool, Alloc> in(100, false, Alloc(1));
6565
std::vector<bool, Alloc> expected(100, true, Alloc(1));
6666
std::ranges::fill_n(std::ranges::begin(in), in.size(), true);
67-
assert(in == expected);
67+
68+
// FIXME: We are currently forced to use the standard `std::equal()` for general `input_iterator`s instead of
69+
// the optimized version for `__bit_iterator`s. This is due to a recently discovered issue #126369 where the
70+
// optimization fails to correctly compare `vector<bool>`s with small integral storage types. Once the issue is
71+
// fixed, we should revert to the optimized version by uncommenting the last line in this code block.
72+
using It = cpp17_input_iterator<std::vector<bool, Alloc>::iterator>;
73+
assert(in.size() == expected.size() && std::equal(It(in.begin()), It(in.end()), It(expected.begin())));
74+
// assert(in == expected); // FIXME: Uncomment this line once issue #126369 is fixed.
6875
}
6976
{
7077
using Alloc = sized_allocator<bool, std::uint16_t, std::int16_t>;
7178
std::vector<bool, Alloc> in(200, false, Alloc(1));
7279
std::vector<bool, Alloc> expected(200, true, Alloc(1));
7380
std::ranges::fill_n(std::ranges::begin(in), in.size(), true);
74-
assert(in == expected);
81+
82+
// FIXME: We are currently forced to use the standard `std::equal()` for general `input_iterator`s instead of
83+
// the optimized version for `__bit_iterator`s. This is due to a recently discovered issue #126369 where the
84+
// optimization fails to correctly compare `vector<bool>`s with small integral storage types. Once the issue is
85+
// fixed, we should revert to the optimized version by uncommenting the last line in this code block.
86+
using It = cpp17_input_iterator<std::vector<bool, Alloc>::iterator>;
87+
assert(in.size() == expected.size() && std::equal(It(in.begin()), It(in.end()), It(expected.begin())));
88+
// assert(in == expected); // FIXME: Uncomment this line once issue #126369 is fixed.
7589
}
7690
{
7791
using Alloc = sized_allocator<bool, std::uint32_t, std::int32_t>;

0 commit comments

Comments
 (0)