[libcxx-commits] [libcxx] [libc++][ranges][enumerate_view] Update sentinel `equal` test (PR #222331)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Sep 9 06:37:52 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Lucas Mellone (lknknm)

<details>
<summary>Changes</summary>

Completes the [range.enumerate.sentinel] `equal` test by addressing the review comment https://github.com/llvm/llvm-project/pull/73617/changes#r1416644183 from the original implementation.

---
Full diff: https://github.com/llvm/llvm-project/pull/222331.diff


1 Files Affected:

- (modified) libcxx/test/std/ranges/range.adaptors/range.enumerate/sentinel/equal.pass.cpp (+14-3) 


``````````diff
diff --git a/libcxx/test/std/ranges/range.adaptors/range.enumerate/sentinel/equal.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.enumerate/sentinel/equal.pass.cpp
index 7bf2898bcd158..b7058ee359c15 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.enumerate/sentinel/equal.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.enumerate/sentinel/equal.pass.cpp
@@ -37,20 +37,31 @@ constexpr void test() {
   std::array array{0, 1, 2, 3, 84};
 
   View mv{Iterator(std::to_address(base(array.begin()))), Sentinel(Iterator(std::to_address(base(array.end()))))};
-  std::ranges::enumerate_view view(std::move(mv));
+  std::ranges::enumerate_view v(std::move(mv));
 
-  auto const it = view.begin();
-  auto const s  = view.end();
+  auto const it   = v.begin();
+  auto const c_it = std::as_const(v).begin();
+  auto const s    = v.end();
 
   std::same_as<bool> decltype(auto) eqItSResult = (it == s);
   assert(!eqItSResult);
   std::same_as<bool> decltype(auto) eqSItResult = (s == it);
   assert(!eqSItResult);
 
+  std::same_as<bool> decltype(auto) eqConstItSResult = (c_it == s);
+  assert(!eqConstItSResult);
+  std::same_as<bool> decltype(auto) eqSConstItResult = (s == c_it);
+  assert(!eqSConstItResult);
+
   std::same_as<bool> decltype(auto) neqItSResult = (it != s);
   assert(neqItSResult);
   std::same_as<bool> decltype(auto) neqSItResult = (s != it);
   assert(neqSItResult);
+
+  std::same_as<bool> decltype(auto) neqConstItSResult = (c_it != s);
+  assert(neqConstItSResult);
+  std::same_as<bool> decltype(auto) neqSConstItResult = (s != c_it);
+  assert(neqSConstItResult);
 }
 
 constexpr bool tests() {

``````````

</details>


https://github.com/llvm/llvm-project/pull/222331


More information about the libcxx-commits mailing list