Skip to content

Commit f63cdbc

Browse files
var-consttru
authored andcommitted
[libc++][ranges] Fix ranges::to test.
- Make a test for an internal concept libc++-only; - Make sure that `size` and `capacity` in a test container return the same type on all platforms. (cherry picked from commit 8b9a986)
1 parent 0521244 commit f63cdbc

File tree

1 file changed

+3
-1
lines changed
  • libcxx/test/std/ranges/range.utility/range.utility.conv

1 file changed

+3
-1
lines changed

libcxx/test/std/ranges/range.utility/range.utility.conv/to.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <vector>
2020
#include "container.h"
2121
#include "test_iterators.h"
22+
#include "test_macros.h"
2223
#include "test_range.h"
2324

2425
template <class Container, class Range, class... Args>
@@ -119,6 +120,7 @@ struct Fallback {
119120
constexpr void push_back(value_type) {}
120121
constexpr value_type* begin() { return &x; }
121122
constexpr value_type* end() { return &x; }
123+
std::size_t size() const { return 0; }
122124
};
123125

124126
struct CtrDirectOrFallback : Fallback {
@@ -180,7 +182,7 @@ struct Reservable : Fallback {
180182
reserve_called = true;
181183
}
182184
};
183-
static_assert(std::ranges::__reservable_container<Reservable<>>);
185+
LIBCPP_STATIC_ASSERT(std::ranges::__reservable_container<Reservable<>>);
184186

185187
constexpr void test_constraints() {
186188
{ // Case 1 -- construct directly from the range.

0 commit comments

Comments
 (0)