[libcxx-commits] [PATCH] D150206: [libc++][ranges] Fix `iota_view`'s constructor's incorrect constraint

Hui Huang via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri May 12 11:22:37 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG868591501c61: [libc++][ranges] Fix `iota_view`'s constructor's incorrect constraint (authored by Hui).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150206

Files:
  libcxx/include/__ranges/iota_view.h
  libcxx/test/std/ranges/range.factories/range.iota.view/ctor.first.last.pass.cpp


Index: libcxx/test/std/ranges/range.factories/range.iota.view/ctor.first.last.pass.cpp
===================================================================
--- libcxx/test/std/ranges/range.factories/range.iota.view/ctor.first.last.pass.cpp
+++ libcxx/test/std/ranges/range.factories/range.iota.view/ctor.first.last.pass.cpp
@@ -76,6 +76,12 @@
     assert(std::ranges::next(io.begin(), 10) == io.end());
   }
 
+  {
+    std::ranges::iota_view<int, std::unreachable_sentinel_t> iv1;
+    // There should be only one overload available and {} resolves to unreachable_sentinel_t
+    [[maybe_unused]] std::ranges::iota_view<int, std::unreachable_sentinel_t> iv2(iv1.begin(), {});
+  }
+
   return true;
 }
 
Index: libcxx/include/__ranges/iota_view.h
===================================================================
--- libcxx/include/__ranges/iota_view.h
+++ libcxx/include/__ranges/iota_view.h
@@ -336,7 +336,7 @@
 
     _LIBCPP_HIDE_FROM_ABI
     constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __sentinel __last)
-      requires(!same_as<_Start, _BoundSentinel> && !same_as<_Start, unreachable_sentinel_t>)
+      requires(!same_as<_Start, _BoundSentinel> && !same_as<_BoundSentinel, unreachable_sentinel_t>)
     : iota_view(std::move(__first.__value_), std::move(__last.__bound_sentinel_)) {}
 
     _LIBCPP_HIDE_FROM_ABI


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150206.521733.patch
Type: text/x-patch
Size: 1348 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230512/e6cae0bd/attachment-0001.bin>


More information about the libcxx-commits mailing list