[libcxx-commits] [libcxx] [libc++][ranges] Backport P2711R1: Making multi-param constructors of views ``explicit`` (PR #190513)

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Sun Apr 5 02:31:22 PDT 2026


https://github.com/H-G-Hristov created https://github.com/llvm/llvm-project/pull/190513

As discussed in https://gcc.gnu.org/PR114298 - GCC and MSVC STL implemented P2711R1 as a DR. This PR proposes to do the same for libc++

# References:
- https://wg21.lin/P2711R1
- https://reviews.llvm.org/D144822

>From 38c859962c065a084d633e59c1560b607040741a Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Sun, 5 Apr 2026 10:09:12 +0300
Subject: [PATCH 1/2] [libc++][ranges] Backport P2711R1: Making multi-param
 constructors of views explicit

As discussed in https://gcc.gnu.org/PR114298 - GCC and MSVC STL implemented P2711R1 as a DR. This PR proposes to do the same for libc++

# References:
- https://wg21.lin/p2711r1
- https://reviews.llvm.org/D144822
---
 libcxx/include/__config                   | 6 ------
 libcxx/include/__ranges/drop_view.h       | 2 +-
 libcxx/include/__ranges/drop_while_view.h | 2 +-
 libcxx/include/__ranges/filter_view.h     | 2 +-
 libcxx/include/__ranges/iota_view.h       | 8 ++++----
 libcxx/include/__ranges/lazy_split_view.h | 4 ++--
 libcxx/include/__ranges/split_view.h      | 4 ++--
 libcxx/include/__ranges/take_view.h       | 2 +-
 libcxx/include/__ranges/take_while_view.h | 2 +-
 libcxx/include/__ranges/transform_view.h  | 2 +-
 10 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/libcxx/include/__config b/libcxx/include/__config
index 942b0a9dbefa3..bd786ef4c371a 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -329,12 +329,6 @@ typedef __char32_t char32_t;
 #    define _LIBCPP_EXPLICIT_SINCE_CXX14 explicit
 #  endif
 
-#  if _LIBCPP_STD_VER >= 23
-#    define _LIBCPP_EXPLICIT_SINCE_CXX23 explicit
-#  else
-#    define _LIBCPP_EXPLICIT_SINCE_CXX23
-#  endif
-
 #  if _LIBCPP_STD_VER >= 14
 #    define _LIBCPP_CONSTEXPR_SINCE_CXX14 constexpr
 #  else
diff --git a/libcxx/include/__ranges/drop_view.h b/libcxx/include/__ranges/drop_view.h
index feb3705d2df6c..ee68429216b37 100644
--- a/libcxx/include/__ranges/drop_view.h
+++ b/libcxx/include/__ranges/drop_view.h
@@ -74,7 +74,7 @@ class drop_view : public view_interface<drop_view<_View>> {
     requires default_initializable<_View>
   = default;
 
-  _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit
   drop_view(_View __base, range_difference_t<_View> __count)
       : __count_(__count), __base_(std::move(__base)) {
     _LIBCPP_ASSERT_UNCATEGORIZED(__count_ >= 0, "count must be greater than or equal to zero.");
diff --git a/libcxx/include/__ranges/drop_while_view.h b/libcxx/include/__ranges/drop_while_view.h
index 1fe4e17f8048b..ed5b91d99425f 100644
--- a/libcxx/include/__ranges/drop_while_view.h
+++ b/libcxx/include/__ranges/drop_while_view.h
@@ -54,7 +54,7 @@ class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS drop_while_view : public view_interfa
     requires default_initializable<_View> && default_initializable<_Pred>
   = default;
 
-  _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 drop_while_view(_View __base, _Pred __pred)
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit drop_while_view(_View __base, _Pred __pred)
       : __base_(std::move(__base)), __pred_(std::in_place, std::move(__pred)) {}
 
   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
diff --git a/libcxx/include/__ranges/filter_view.h b/libcxx/include/__ranges/filter_view.h
index 3ad69ea100931..4612dc4a9ba1d 100644
--- a/libcxx/include/__ranges/filter_view.h
+++ b/libcxx/include/__ranges/filter_view.h
@@ -72,7 +72,7 @@ class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS filter_view : public view_interface<f
     requires default_initializable<_View> && default_initializable<_Pred>
   = default;
 
-  _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 filter_view(_View __base, _Pred __pred)
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit filter_view(_View __base, _Pred __pred)
       : __base_(std::move(__base)), __pred_(in_place, std::move(__pred)) {}
 
   template <class _Vp = _View>
diff --git a/libcxx/include/__ranges/iota_view.h b/libcxx/include/__ranges/iota_view.h
index 6b2576ec6b23d..86c2fc498580f 100644
--- a/libcxx/include/__ranges/iota_view.h
+++ b/libcxx/include/__ranges/iota_view.h
@@ -316,7 +316,7 @@ class iota_view : public view_interface<iota_view<_Start, _BoundSentinel>> {
 
   _LIBCPP_HIDE_FROM_ABI constexpr explicit iota_view(_Start __value) : __value_(std::move(__value)) {}
 
-  _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit
   iota_view(type_identity_t<_Start> __value, type_identity_t<_BoundSentinel> __bound_sentinel)
       : __value_(std::move(__value)), __bound_sentinel_(std::move(__bound_sentinel)) {
     // Validate the precondition if possible.
@@ -326,15 +326,15 @@ class iota_view : public view_interface<iota_view<_Start, _BoundSentinel>> {
     }
   }
 
-  _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __iterator __last)
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit iota_view(__iterator __first, __iterator __last)
     requires same_as<_Start, _BoundSentinel>
       : iota_view(std::move(__first.__value_), std::move(__last.__value_)) {}
 
-  _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, _BoundSentinel __last)
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit iota_view(__iterator __first, _BoundSentinel __last)
     requires same_as<_BoundSentinel, unreachable_sentinel_t>
       : iota_view(std::move(__first.__value_), std::move(__last)) {}
 
-  _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __sentinel __last)
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit iota_view(__iterator __first, __sentinel __last)
     requires(!same_as<_Start, _BoundSentinel> && !same_as<_BoundSentinel, unreachable_sentinel_t>)
       : iota_view(std::move(__first.__value_), std::move(__last.__bound_sentinel_)) {}
 
diff --git a/libcxx/include/__ranges/lazy_split_view.h b/libcxx/include/__ranges/lazy_split_view.h
index cca9191d26818..938dca24cc4fc 100644
--- a/libcxx/include/__ranges/lazy_split_view.h
+++ b/libcxx/include/__ranges/lazy_split_view.h
@@ -86,13 +86,13 @@ class lazy_split_view : public view_interface<lazy_split_view<_View, _Pattern>>
     requires default_initializable<_View> && default_initializable<_Pattern>
   = default;
 
-  _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 lazy_split_view(_View __base, _Pattern __pattern)
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit lazy_split_view(_View __base, _Pattern __pattern)
       : __base_(std::move(__base)), __pattern_(std::move(__pattern)) {}
 
   template <input_range _Range>
     requires constructible_from<_View, views::all_t<_Range>> &&
                  constructible_from<_Pattern, single_view<range_value_t<_Range>>>
-  _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 lazy_split_view(_Range&& __r, range_value_t<_Range> __e)
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit lazy_split_view(_Range&& __r, range_value_t<_Range> __e)
       : __base_(views::all(std::forward<_Range>(__r))), __pattern_(views::single(std::move(__e))) {}
 
   _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
diff --git a/libcxx/include/__ranges/split_view.h b/libcxx/include/__ranges/split_view.h
index 2ec908ba4070e..ed323b0014da9 100644
--- a/libcxx/include/__ranges/split_view.h
+++ b/libcxx/include/__ranges/split_view.h
@@ -78,13 +78,13 @@ class split_view : public view_interface<split_view<_View, _Pattern>> {
     requires default_initializable<_View> && default_initializable<_Pattern>
   = default;
 
-  _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 split_view(_View __base, _Pattern __pattern)
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit split_view(_View __base, _Pattern __pattern)
       : __base_(std::move(__base)), __pattern_(std::move((__pattern))) {}
 
   template <forward_range _Range>
     requires constructible_from<_View, views::all_t<_Range>> &&
                  constructible_from<_Pattern, single_view<range_value_t<_Range>>>
-  _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit
   split_view(_Range&& __range, range_value_t<_Range> __elem)
       : __base_(views::all(std::forward<_Range>(__range))), __pattern_(views::single(std::move(__elem))) {}
 
diff --git a/libcxx/include/__ranges/take_view.h b/libcxx/include/__ranges/take_view.h
index 13cb4a285d9df..927f56d7eeb64 100644
--- a/libcxx/include/__ranges/take_view.h
+++ b/libcxx/include/__ranges/take_view.h
@@ -69,7 +69,7 @@ class take_view : public view_interface<take_view<_View>> {
     requires default_initializable<_View>
   = default;
 
-  _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit
   take_view(_View __base, range_difference_t<_View> __count)
       : __base_(std::move(__base)), __count_(__count) {
     _LIBCPP_ASSERT_UNCATEGORIZED(__count >= 0, "count has to be greater than or equal to zero");
diff --git a/libcxx/include/__ranges/take_while_view.h b/libcxx/include/__ranges/take_while_view.h
index 4977f139fc555..955f681ef76ed 100644
--- a/libcxx/include/__ranges/take_while_view.h
+++ b/libcxx/include/__ranges/take_while_view.h
@@ -58,7 +58,7 @@ class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS take_while_view : public view_interfa
     requires default_initializable<_View> && default_initializable<_Pred>
   = default;
 
-  _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 take_while_view(_View __base, _Pred __pred)
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit take_while_view(_View __base, _Pred __pred)
       : __base_(std::move(__base)), __pred_(std::in_place, std::move(__pred)) {}
 
   _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
diff --git a/libcxx/include/__ranges/transform_view.h b/libcxx/include/__ranges/transform_view.h
index ab1adf9cdbe68..9fec673b4b656 100644
--- a/libcxx/include/__ranges/transform_view.h
+++ b/libcxx/include/__ranges/transform_view.h
@@ -85,7 +85,7 @@ class _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS transform_view : public view_interfac
     requires default_initializable<_View> && default_initializable<_Fn>
   = default;
 
-  _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 transform_view(_View __base, _Fn __func)
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit transform_view(_View __base, _Fn __func)
       : __func_(std::in_place, std::move(__func)), __base_(std::move(__base)) {}
 
   _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&

>From f92209299c9c9a4ca1ab8acf7c6666e1f4ee98b4 Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Sun, 5 Apr 2026 12:09:14 +0300
Subject: [PATCH 2/2] Update tests

---
 .../range.drop.while/ctor.view.pass.cpp       |  9 --------
 .../range.drop/ctor.view.pass.cpp             |  9 --------
 .../range.filter/ctor.view_pred.pass.cpp      | 11 +---------
 .../range.lazy.split/ctor.range.pass.cpp      |  7 ------
 .../range.lazy.split/ctor.view.pass.cpp       | 22 +++++--------------
 .../range.split/ctor.range.pass.cpp           | 10 ---------
 .../range.split/ctor.view.pass.cpp            |  9 --------
 .../range.take.while/ctor.view.pass.cpp       |  9 --------
 .../range.take/ctor.view_count.pass.cpp       |  9 --------
 .../ctor.view_function.pass.cpp               |  9 --------
 .../range.iota.view/ctor.first.last.pass.cpp  | 22 -------------------
 .../range.iota.view/ctor.value.bound.pass.cpp | 21 ------------------
 12 files changed, 6 insertions(+), 141 deletions(-)

diff --git a/libcxx/test/std/ranges/range.adaptors/range.drop.while/ctor.view.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.drop.while/ctor.view.pass.cpp
index 326cabd637089..dcc31bd7c2a65 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.drop.while/ctor.view.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.drop.while/ctor.view.pass.cpp
@@ -36,18 +36,9 @@ struct Pred {
 
 // SFINAE tests.
 
-#if TEST_STD_VER >= 23
-
 static_assert(!test_convertible<std::ranges::drop_while_view<View, Pred>, View, Pred>(),
               "This constructor must be explicit");
 
-#else
-
-static_assert( test_convertible<std::ranges::drop_while_view<View, Pred>, View, Pred>(),
-              "This constructor must not be explicit");
-
-#endif // TEST_STD_VER >= 23
-
 constexpr bool test() {
   {
     std::ranges::drop_while_view<View, Pred> dwv{View{{}, MoveOnly{5}}, Pred{}};
diff --git a/libcxx/test/std/ranges/range.adaptors/range.drop/ctor.view.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.drop/ctor.view.pass.cpp
index aeb31ae2fec4b..43d04c75c70b1 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.drop/ctor.view.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.drop/ctor.view.pass.cpp
@@ -19,18 +19,9 @@
 
 // SFINAE tests.
 
-#if TEST_STD_VER >= 23
-
 static_assert(!test_convertible<std::ranges::drop_view<View>, View, std::ranges::range_difference_t<View>>(),
               "This constructor must be explicit");
 
-#else
-
-static_assert(test_convertible<std::ranges::drop_view<View>, View, std::ranges::range_difference_t<View>>(),
-              "This constructor must not be explicit");
-
-#endif // TEST_STD_VER >= 23
-
 constexpr bool test() {
   std::ranges::drop_view dropView1(MoveOnlyView(), 4);
   assert(dropView1.size() == 4);
diff --git a/libcxx/test/std/ranges/range.adaptors/range.filter/ctor.view_pred.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.filter/ctor.view_pred.pass.cpp
index 3ccab93397147..00a4caf248786 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.filter/ctor.view_pred.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.filter/ctor.view_pred.pass.cpp
@@ -19,7 +19,7 @@
 #include "types.h"
 
 struct Range : std::ranges::view_base {
-  constexpr explicit Range(int* b, int* e) : begin_(b), end_(e) { }
+  constexpr explicit Range(int* b, int* e) : begin_(b), end_(e) {}
   constexpr int* begin() const { return begin_; }
   constexpr int* end() const { return end_; }
 
@@ -45,18 +45,9 @@ struct TrackingRange : TrackInitialization, std::ranges::view_base {
 
 // SFINAE tests.
 
-#if TEST_STD_VER >= 23
-
 static_assert(!test_convertible<std::ranges::filter_view<Range, Pred>, Range, Pred>(),
               "This constructor must be explicit");
 
-#else
-
-static_assert( test_convertible<std::ranges::filter_view<Range, Pred>, Range, Pred>(),
-              "This constructor must not be explicit");
-
-#endif // TEST_STD_VER >= 23
-
 constexpr bool test() {
   int buff[] = {1, 2, 3, 4, 5, 6, 7, 8};
 
diff --git a/libcxx/test/std/ranges/range.adaptors/range.lazy.split/ctor.range.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.lazy.split/ctor.range.pass.cpp
index 8eeaa3dae36db..3097e6db0f009 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.lazy.split/ctor.range.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.lazy.split/ctor.range.pass.cpp
@@ -88,19 +88,12 @@ static_assert(std::is_copy_constructible_v<StrView>);
 
 // SFINAE tests.
 
-#if TEST_STD_VER >= 23
 
 static_assert(
     !test_convertible<std::ranges::lazy_split_view<StrView, StrView>, StrView, std::ranges::range_value_t<StrView>>(),
     "This constructor must be explicit");
 
-#else
 
-static_assert(
-    test_convertible<std::ranges::lazy_split_view<StrView, StrView>, StrView, std::ranges::range_value_t<StrView>>(),
-    "This constructor must not be explicit");
-
-#endif // TEST_STD_VER >= 23
 
 constexpr bool test() {
   {
diff --git a/libcxx/test/std/ranges/range.adaptors/range.lazy.split/ctor.view.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.lazy.split/ctor.view.pass.cpp
index e7bf052a7e9ee..58a966d78e1c7 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.lazy.split/ctor.view.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.lazy.split/ctor.view.pass.cpp
@@ -20,18 +20,15 @@
 
 struct ViewWithCounting : std::ranges::view_base {
   int* times_copied = nullptr;
-  int* times_moved = nullptr;
+  int* times_moved  = nullptr;
 
   constexpr ViewWithCounting(int& copies_ctr, int& moves_ctr) : times_copied(&copies_ctr), times_moved(&moves_ctr) {}
 
   constexpr ViewWithCounting(const ViewWithCounting& rhs)
-    : times_copied(rhs.times_copied)
-    , times_moved(rhs.times_moved) {
+      : times_copied(rhs.times_copied), times_moved(rhs.times_moved) {
     ++(*times_copied);
   }
-  constexpr ViewWithCounting(ViewWithCounting&& rhs)
-    : times_copied(rhs.times_copied)
-    , times_moved(rhs.times_moved) {
+  constexpr ViewWithCounting(ViewWithCounting&& rhs) : times_copied(rhs.times_copied), times_moved(rhs.times_moved) {
     ++(*times_moved);
   }
 
@@ -39,30 +36,21 @@ struct ViewWithCounting : std::ranges::view_base {
   constexpr const char* end() const { return nullptr; }
 
   constexpr ViewWithCounting& operator=(const ViewWithCounting&) = default;
-  constexpr ViewWithCounting& operator=(ViewWithCounting&&) = default;
+  constexpr ViewWithCounting& operator=(ViewWithCounting&&)      = default;
   constexpr bool operator==(const ViewWithCounting&) const { return true; }
 };
 
 static_assert(std::ranges::forward_range<ViewWithCounting>);
 static_assert(std::ranges::view<ViewWithCounting>);
 
-using View = ViewWithCounting;
+using View    = ViewWithCounting;
 using Pattern = ViewWithCounting;
 
 // SFINAE tests.
 
-#if TEST_STD_VER >= 23
-
 static_assert(!test_convertible<std::ranges::lazy_split_view<View, Pattern>, View, Pattern>(),
               "This constructor must be explicit");
 
-#else
-
-static_assert( test_convertible<std::ranges::lazy_split_view<View, Pattern>, View, Pattern>(),
-              "This constructor must not be explicit");
-
-#endif // TEST_STD_VER >= 23
-
 constexpr bool test() {
   // Calling the constructor with `(ForwardView, ForwardView)`.
   {
diff --git a/libcxx/test/std/ranges/range.adaptors/range.split/ctor.range.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.split/ctor.range.pass.cpp
index bbe08befdb419..7a27a9548c229 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.split/ctor.range.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.split/ctor.range.pass.cpp
@@ -73,20 +73,10 @@ static_assert(std::is_copy_constructible_v<StrView>);
 
 // SFINAE tests.
 
-#if TEST_STD_VER >= 23
-
 static_assert(
     !test_convertible<std::ranges::split_view<StrView, StrView>, StrView, std::ranges::range_value_t<StrView>>(),
     "This constructor must be explicit");
 
-# else
-
-static_assert(
-    test_convertible<std::ranges::split_view<StrView, StrView>, StrView, std::ranges::range_value_t<StrView>>(),
-    "This constructor must not be explicit");
-
-#endif // TEST_STD_VER >= 23
-
 constexpr bool test() {
   {
     using V = std::ranges::split_view<StrView, StrView>;
diff --git a/libcxx/test/std/ranges/range.adaptors/range.split/ctor.view.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.split/ctor.view.pass.cpp
index 27fc4b84c5206..7826d8969b97d 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.split/ctor.view.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.split/ctor.view.pass.cpp
@@ -46,18 +46,9 @@ using Pattern = ViewWithCounting;
 
 // SFINAE tests.
 
-#if TEST_STD_VER >= 23
-
 static_assert(!test_convertible<std::ranges::split_view<View, Pattern>, View, Pattern>(),
               "This constructor must be explicit");
 
-#else
-
-static_assert( test_convertible<std::ranges::split_view<View, Pattern>, View, Pattern>(),
-              "This constructor must not be explicit");
-
-#endif // TEST_STD_VER >= 23
-
 constexpr bool test() {
   {
     std::string_view input = "abc def";
diff --git a/libcxx/test/std/ranges/range.adaptors/range.take.while/ctor.view.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.take.while/ctor.view.pass.cpp
index 469b2698c8844..28cef83a6cf72 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.take.while/ctor.view.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.take.while/ctor.view.pass.cpp
@@ -36,18 +36,9 @@ struct Pred {
 
 // SFINAE tests.
 
-#if TEST_STD_VER >= 23
-
 static_assert(!test_convertible<std::ranges::take_while_view<View, Pred>, View, Pred>(),
               "This constructor must be explicit");
 
-#else
-
-static_assert(test_convertible<std::ranges::take_while_view<View, Pred>, View, Pred>(),
-              "This constructor must not be explicit");
-
-#endif // TEST_STD_VER >= 23
-
 constexpr bool test() {
   {
     std::ranges::take_while_view<View, Pred> twv{View{{}, MoveOnly{5}}, Pred{}};
diff --git a/libcxx/test/std/ranges/range.adaptors/range.take/ctor.view_count.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.take/ctor.view_count.pass.cpp
index f37ffb0825ac1..fdc4bb4b23261 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.take/ctor.view_count.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.take/ctor.view_count.pass.cpp
@@ -21,18 +21,9 @@
 
 // SFINAE tests.
 
-#if TEST_STD_VER >= 23
-
 static_assert(!test_convertible<std::ranges::take_view<View>, View, std::ranges::range_difference_t<View>>(),
               "This constructor must be explicit");
 
-#else
-
-static_assert(test_convertible<std::ranges::take_view<View>, View, std::ranges::range_difference_t<View>>(),
-              "This constructor must be explicit");
-
-#endif // TEST_STD_VER >= 23
-
 constexpr bool test() {
   int buffer[8] = {1, 2, 3, 4, 5, 6, 7, 8};
 
diff --git a/libcxx/test/std/ranges/range.adaptors/range.transform/ctor.view_function.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.transform/ctor.view_function.pass.cpp
index 63a43d189256f..5593b778467f6 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.transform/ctor.view_function.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.transform/ctor.view_function.pass.cpp
@@ -32,18 +32,9 @@ struct F {
 
 // SFINAE tests.
 
-#if TEST_STD_VER >= 23
-
 static_assert(!test_convertible<std::ranges::transform_view<Range, F>, Range, F>(),
               "This constructor must be explicit");
 
-#else
-
-static_assert( test_convertible<std::ranges::transform_view<Range, F>, Range, F>(),
-              "This constructor must not be explicit");
-
-#endif // TEST_STD_VER >= 23
-
 constexpr bool test() {
   int buff[] = {1, 2, 3, 4, 5, 6, 7, 8};
 
diff --git a/libcxx/test/std/ranges/range.factories/range.iota.view/ctor.first.last.pass.cpp b/libcxx/test/std/ranges/range.factories/range.iota.view/ctor.first.last.pass.cpp
index 67b7dc428a14f..2f61591e11677 100644
--- a/libcxx/test/std/ranges/range.factories/range.iota.view/ctor.first.last.pass.cpp
+++ b/libcxx/test/std/ranges/range.factories/range.iota.view/ctor.first.last.pass.cpp
@@ -19,8 +19,6 @@
 
 // SFINAE tests.
 
-#if TEST_STD_VER >= 23
-
 std::ranges::iota_view<SomeInt, SomeInt> view;
 
 static_assert(!test_convertible<std::ranges::iota_view<SomeInt, SomeInt>,
@@ -38,25 +36,6 @@ static_assert(!test_convertible<std::ranges::iota_view<SomeInt, IntComparableWit
                                 decltype(std::ranges::iota_view{SomeInt(0), IntComparableWith(SomeInt(10))}.end())>(),
               "This constructor must be explicit");
 
-#else
-
-static_assert(test_convertible<std::ranges::iota_view<SomeInt, SomeInt>,
-                               decltype(std::ranges::iota_view<SomeInt, SomeInt>{}.begin()),
-                               decltype(std::ranges::iota_view<SomeInt, SomeInt>{}.end())>(),
-              "This constructor must not be explicit");
-
-static_assert(test_convertible<std::ranges::iota_view<SomeInt>,
-                               decltype(std::ranges::iota_view{SomeInt{0}}.begin()),
-                               decltype(std::unreachable_sentinel)>(),
-              "This constructor must not be explicit");
-
-static_assert(test_convertible<std::ranges::iota_view<SomeInt, IntComparableWith<SomeInt>>,
-                               decltype(std::ranges::iota_view{SomeInt(0), IntComparableWith(SomeInt(10))}.begin()),
-                               decltype(std::ranges::iota_view{SomeInt(0), IntComparableWith(SomeInt(10))}.end())>(),
-              "This constructor must not be explicit");
-
-#endif // TEST_STD_VER >= 23
-
 constexpr bool test() {
   {
     std::ranges::iota_view commonView(SomeInt(0), SomeInt(10));
@@ -91,4 +70,3 @@ int main(int, char**) {
 
   return 0;
 }
-
diff --git a/libcxx/test/std/ranges/range.factories/range.iota.view/ctor.value.bound.pass.cpp b/libcxx/test/std/ranges/range.factories/range.iota.view/ctor.value.bound.pass.cpp
index 7528e1ccf3ee0..7aa65e58fb6cc 100644
--- a/libcxx/test/std/ranges/range.factories/range.iota.view/ctor.value.bound.pass.cpp
+++ b/libcxx/test/std/ranges/range.factories/range.iota.view/ctor.value.bound.pass.cpp
@@ -24,8 +24,6 @@ TEST_MSVC_DIAGNOSTIC_IGNORED(4018 4389) // various "signed/unsigned mismatch"
 
 // SFINAE tests.
 
-#if TEST_STD_VER >= 23
-
 static_assert(!test_convertible<std::ranges::iota_view<SomeInt, SomeInt>,
                                 decltype(std::ranges::iota_view<SomeInt, SomeInt>{}.begin()),
                                 decltype(std::ranges::iota_view<SomeInt, SomeInt>{}.end())>(),
@@ -41,25 +39,6 @@ static_assert(!test_convertible<std::ranges::iota_view<SomeInt, IntComparableWit
                                 decltype(std::ranges::iota_view{SomeInt(0), IntComparableWith(SomeInt(10))}.end())>(),
               "This constructor must be explicit");
 
-#else
-
-static_assert( test_convertible<std::ranges::iota_view<SomeInt, SomeInt>,
-                                decltype(std::ranges::iota_view<SomeInt, SomeInt>{}.begin()),
-                                decltype(std::ranges::iota_view<SomeInt, SomeInt>{}.end())>(),
-              "This constructor must not be explicit");
-
-static_assert( test_convertible<std::ranges::iota_view<SomeInt>,
-                                decltype(std::ranges::iota_view<SomeInt>{}.begin()),
-                                decltype(std::unreachable_sentinel)>(),
-              "This constructor must not be explicit");
-
-static_assert( test_convertible<std::ranges::iota_view<SomeInt, IntComparableWith<SomeInt>>,
-                                decltype(std::ranges::iota_view{SomeInt(0), IntComparableWith(SomeInt(10))}.begin()),
-                                decltype(std::ranges::iota_view{SomeInt(0), IntComparableWith(SomeInt(10))}.end())>(),
-              "This constructor must not be explicit");
-
-#endif // TEST_STD_VER >= 23
-
 constexpr bool test() {
   {
     std::ranges::iota_view<SomeInt, SomeInt> io(SomeInt(0), SomeInt(10));



More information about the libcxx-commits mailing list