[libcxx-commits] [PATCH] D112631: [libc++][test] Fix invalid test for views::view_interface

Joe Loser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Oct 27 14:14:30 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGc3cd5f5b4f8e: [libc++][test] Fix invalid test for views::view_interface (authored by joe_loser).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112631/new/

https://reviews.llvm.org/D112631

Files:
  libcxx/test/std/ranges/range.utility/view.interface/view.interface.pass.cpp


Index: libcxx/test/std/ranges/range.utility/view.interface/view.interface.pass.cpp
===================================================================
--- libcxx/test/std/ranges/range.utility/view.interface/view.interface.pass.cpp
+++ libcxx/test/std/ranges/range.utility/view.interface/view.interface.pass.cpp
@@ -68,15 +68,18 @@
   constexpr ForwardIter begin() const { return ForwardIter(const_cast<int*>(buff)); }
   constexpr ForwardIter end() const { return ForwardIter(const_cast<int*>(buff) + 8); }
 };
+static_assert(std::ranges::view<ForwardRange>);
 
 struct MoveOnlyForwardRange : std::ranges::view_interface<MoveOnlyForwardRange> {
   int buff[8] = {0, 1, 2, 3, 4, 5, 6, 7};
   MoveOnlyForwardRange(MoveOnlyForwardRange const&) = delete;
   MoveOnlyForwardRange(MoveOnlyForwardRange &&) = default;
+  MoveOnlyForwardRange& operator=(MoveOnlyForwardRange &&) = default;
   MoveOnlyForwardRange() = default;
   constexpr ForwardIter begin() const { return ForwardIter(const_cast<int*>(buff)); }
   constexpr ForwardIter end() const { return ForwardIter(const_cast<int*>(buff) + 8); }
 };
+static_assert(std::ranges::view<MoveOnlyForwardRange>);
 
 struct EmptyIsTrue : std::ranges::view_interface<EmptyIsTrue> {
   int buff[8] = {0, 1, 2, 3, 4, 5, 6, 7};
@@ -84,6 +87,7 @@
   constexpr ForwardIter end() const { return ForwardIter(const_cast<int*>(buff) + 8); }
   constexpr bool empty() const { return true; }
 };
+static_assert(std::ranges::view<EmptyIsTrue>);
 
 struct SizeIsTen : std::ranges::view_interface<SizeIsTen> {
   int buff[8] = {0, 1, 2, 3, 4, 5, 6, 7};
@@ -91,6 +95,7 @@
   constexpr ForwardIter end() const { return ForwardIter(const_cast<int*>(buff) + 8); }
   constexpr size_t size() const { return 10; }
 };
+static_assert(std::ranges::view<SizeIsTen>);
 
 using RAIter = random_access_iterator<int*>;
 
@@ -99,6 +104,7 @@
   constexpr RAIter begin() const { return RAIter(const_cast<int*>(buff)); }
   constexpr RAIter end() const { return RAIter(const_cast<int*>(buff) + 8); }
 };
+static_assert(std::ranges::view<RARange>);
 
 using ContIter = contiguous_iterator<const int*>;
 
@@ -107,6 +113,7 @@
   constexpr ContIter begin() const { return ContIter(buff); }
   constexpr ContIter end() const { return ContIter(buff + 8); }
 };
+static_assert(std::ranges::view<ContRange>);
 
 struct DataIsNull : std::ranges::view_interface<DataIsNull> {
   int buff[8] = {0, 1, 2, 3, 4, 5, 6, 7};
@@ -114,6 +121,7 @@
   constexpr ContIter end() const { return ContIter(buff + 8); }
   constexpr const int *data() const { return nullptr; }
 };
+static_assert(std::ranges::view<DataIsNull>);
 
 template<bool IsNoexcept>
 struct BoolConvertibleComparison : std::ranges::view_interface<BoolConvertibleComparison<IsNoexcept>> {
@@ -136,6 +144,8 @@
   constexpr ForwardIter begin() const noexcept { return ForwardIter(const_cast<int*>(buff)); }
   constexpr SentinelType end() const noexcept { return SentinelType(const_cast<int*>(buff) + 8); }
 };
+static_assert(std::ranges::view<BoolConvertibleComparison<true>>);
+static_assert(std::ranges::view<BoolConvertibleComparison<false>>);
 
 template<class T>
 concept EmptyInvocable = requires (T const& obj) { obj.empty(); };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112631.382789.patch
Type: text/x-patch
Size: 3192 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211027/6d8cd55d/attachment.bin>


More information about the libcxx-commits mailing list