[libcxx-commits] [libcxx] [libc++][ranges][enumerate_view] Fix iterator converting constructor test (PR #212044)

Lucas Mellone via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 30 03:23:41 PDT 2026


================
@@ -64,6 +73,17 @@ constexpr void test() {
     assert(index == 1);
     assert(value == 84);
   }
+  {
+    // underlying non-const to const not convertible
+    int buffer[3] = {1, 2, 3};
+    std::ranges::enumerate_view v(ConstIterIncompatibleView{buffer});
+    auto iter1 = v.begin();
+    auto iter2 = std::as_const(v).begin();
+
+    static_assert(!std::is_same_v<decltype(iter1), decltype(iter2)>);
+    static_assert(!std::constructible_from<decltype(iter1), decltype(iter2)>);
+    static_assert(!std::constructible_from<decltype(iter2), decltype(iter1)>);
+  }
----------------
lknknm wrote:

Done and I've also slightly updated the PR description. Please take a look.

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


More information about the libcxx-commits mailing list