[libcxx-commits] [libcxx] 8b9a986 - [libc++][ranges] Fix `ranges::to` test.

Konstantin Varlamov via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 27 15:30:20 PDT 2023


Author: Konstantin Varlamov
Date: 2023-07-27T15:30:11-07:00
New Revision: 8b9a98661b780a5b50d1d6a1f822d25e0c454382

URL: https://github.com/llvm/llvm-project/commit/8b9a98661b780a5b50d1d6a1f822d25e0c454382
DIFF: https://github.com/llvm/llvm-project/commit/8b9a98661b780a5b50d1d6a1f822d25e0c454382.diff

LOG: [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.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/ranges/range.utility/range.utility.conv/to.pass.cpp b/libcxx/test/std/ranges/range.utility/range.utility.conv/to.pass.cpp
index 75f55bc420d0eb..03270f25fd92b2 100644
--- a/libcxx/test/std/ranges/range.utility/range.utility.conv/to.pass.cpp
+++ b/libcxx/test/std/ranges/range.utility/range.utility.conv/to.pass.cpp
@@ -19,6 +19,7 @@
 #include <vector>
 #include "container.h"
 #include "test_iterators.h"
+#include "test_macros.h"
 #include "test_range.h"
 
 template <class Container, class Range, class... Args>
@@ -119,6 +120,7 @@ struct Fallback {
   constexpr void push_back(value_type) {}
   constexpr value_type* begin() { return &x; }
   constexpr value_type* end() { return &x; }
+  std::size_t size() const { return 0; }
 };
 
 struct CtrDirectOrFallback : Fallback {
@@ -180,7 +182,7 @@ struct Reservable : Fallback {
     reserve_called = true;
   }
 };
-static_assert(std::ranges::__reservable_container<Reservable<>>);
+LIBCPP_STATIC_ASSERT(std::ranges::__reservable_container<Reservable<>>);
 
 constexpr void test_constraints() {
   { // Case 1 -- construct directly from the range.


        


More information about the libcxx-commits mailing list