[libcxx-commits] [libcxx] [libc++][ranges] LWG4013: Make lazy_split_view::outer-iterator::value_type non-default-constructible (PR #221919)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Tue Sep 8 02:22:34 PDT 2026


================
@@ -8,28 +8,22 @@
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
 
-// std::ranges::lazy_split_view::outer-iterator::value_type::value_type()
+// LWG 4013: lazy_split_view::outer-iterator::value_type should not provide a default constructor
 
+// class std::ranges::lazy_split_view::outer-iterator::value_type
+
+#include <concepts>
 #include <ranges>
+#include <type_traits>
 
 #include "../types.h"
 
 constexpr bool test() {
-  {
-    [[maybe_unused]] ValueTypeForward val;
-  }
-
-  {
-    [[maybe_unused]] ValueTypeForward val = {};
-  }
-
-  {
-    [[maybe_unused]] ValueTypeInput val;
-  }
+  static_assert(!std::default_initializable<ValueTypeForward>);
+  static_assert(!std::is_default_constructible_v<ValueTypeForward>);
----------------
frederick-vs-ja wrote:

We only need `static_assert(!std::is_default_constructible_v<ValueTypeForward>);` because it's strictly stronger than `static_assert(!std::default_initializable<ValueTypeForward>);`.

On the other hand, if we need a positive test case, `default_initializable` should be preferred to `is_default_constructible_v`.

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


More information about the libcxx-commits mailing list