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

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 30 03:23:06 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)>);
----------------
Zingam wrote:

Can we use the std::same_as concept and get away without including `<type_traits>`?

Please make sure you are testing the converting constructor and nothing else? Remove/Update the redundant test cases.

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


More information about the libcxx-commits mailing list