From 5038b60fc31a591277281b6b7dc48348146b8753 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Mon, 25 Mar 2024 00:53:10 +0800 Subject: [PATCH 1/3] Implement LWG-4013 --- stl/inc/ranges | 7 ++++--- .../std/tests/P0896R4_views_lazy_split/test.cpp | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/stl/inc/ranges b/stl/inc/ranges index 30d22d9c4f5..c138ccf0df7 100644 --- a/stl/inc/ranges +++ b/stl/inc/ranges @@ -4702,12 +4702,13 @@ namespace ranges { private: /* [[no_unique_address]] */ _Outer_iter _First{}; - public: - value_type() = default; constexpr explicit value_type(_Outer_iter _First_) noexcept( - is_nothrow_move_constructible_v<_Outer_iter>) // strengthened + is_nothrow_move_constructible_v<_Outer_iter>) : _First{_STD move(_First_)} {} + friend _Outer_iter; + + public: _NODISCARD constexpr auto begin() const { return _Inner_iter<_Const>{_First}; } diff --git a/tests/std/tests/P0896R4_views_lazy_split/test.cpp b/tests/std/tests/P0896R4_views_lazy_split/test.cpp index 8a688e0da39..1400ffe8a1b 100644 --- a/tests/std/tests/P0896R4_views_lazy_split/test.cpp +++ b/tests/std/tests/P0896R4_views_lazy_split/test.cpp @@ -63,6 +63,10 @@ constexpr void test_one(Base&& base, Delimiter&& delimiter, Expected&& expected) STATIC_ASSERT(same_as); STATIC_ASSERT(noexcept(base | closure) == is_noexcept); + + using outer_iterator = decltype(views::lazy_split(base, delimiter).begin()); + STATIC_ASSERT(!is_default_constructible_v>); // LWG-4013 + STATIC_ASSERT(!is_constructible_v, outer_iterator>); // LWG-4013 } // ... with const lvalue argument @@ -77,6 +81,10 @@ constexpr void test_one(Base&& base, Delimiter&& delimiter, Expected&& expected) STATIC_ASSERT(same_as); STATIC_ASSERT(noexcept(as_const(base) | closure) == is_noexcept); + + using outer_iterator = decltype(views::lazy_split(as_const(base), delimiter).begin()); + STATIC_ASSERT(!is_default_constructible_v>); // LWG-4013 + STATIC_ASSERT(!is_constructible_v, outer_iterator>); // LWG-4013 } else if constexpr (!is_view) { using LSV = ranges::lazy_split_view>, DV>; constexpr bool is_noexcept = is_nothrow_constructible_v&, Delimiter&>; @@ -99,6 +107,10 @@ constexpr void test_one(Base&& base, Delimiter&& delimiter, Expected&& expected) STATIC_ASSERT(same_as); STATIC_ASSERT(noexcept(move(base) | closure) == is_noexcept); + + using outer_iterator = decltype(views::lazy_split(move(base), delimiter).begin()); + STATIC_ASSERT(!is_default_constructible_v>); // LWG-4013 + STATIC_ASSERT(!is_constructible_v, outer_iterator>); // LWG-4013 } else if constexpr (movable>) { using RS = ranges::lazy_split_view>, DV>; constexpr bool is_noexcept = @@ -123,6 +135,10 @@ constexpr void test_one(Base&& base, Delimiter&& delimiter, Expected&& expected) STATIC_ASSERT(same_as); STATIC_ASSERT(noexcept(move(as_const(base)) | closure) == is_noexcept); + + using outer_iterator = decltype(views::lazy_split(move(as_const(base)), delimiter).begin()); + STATIC_ASSERT(!is_default_constructible_v>); // LWG-4013 + STATIC_ASSERT(!is_constructible_v, outer_iterator>); // LWG-4013 } // Validate deduction guide From 8a96a431b7e386800ac4ccb9d844f70028b37429 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Mon, 25 Mar 2024 07:20:33 +0800 Subject: [PATCH 2/3] Skip one libcxx test - std/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer.value/ctor.iter.pass.cpp --- tests/libcxx/expected_results.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/libcxx/expected_results.txt b/tests/libcxx/expected_results.txt index 69cabaff366..1d7c9b3760d 100644 --- a/tests/libcxx/expected_results.txt +++ b/tests/libcxx/expected_results.txt @@ -165,6 +165,9 @@ std/utilities/memory/specialized.algorithms/uninitialized.fill.n/ranges_uninitia std/utilities/memory/specialized.algorithms/uninitialized.move/ranges_uninitialized_move.pass.cpp FAIL std/utilities/memory/specialized.algorithms/uninitialized.move/ranges_uninitialized_move_n.pass.cpp FAIL +# libc++ doesn't implement LWG-4013 +std/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer.value/ctor.iter.pass.cpp FAIL + # If any feature-test macro test is failing, this consolidated test will also fail. std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp FAIL From bf56838004e5d7cbb48b7f99013d8346353f6ef7 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Mon, 25 Mar 2024 08:26:20 +0800 Subject: [PATCH 3/3] Skip another libcxx test - std/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer.value/ctor.default.pass.cpp --- tests/libcxx/expected_results.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/libcxx/expected_results.txt b/tests/libcxx/expected_results.txt index 1d7c9b3760d..ba26ae5bc1f 100644 --- a/tests/libcxx/expected_results.txt +++ b/tests/libcxx/expected_results.txt @@ -166,6 +166,7 @@ std/utilities/memory/specialized.algorithms/uninitialized.move/ranges_uninitiali std/utilities/memory/specialized.algorithms/uninitialized.move/ranges_uninitialized_move_n.pass.cpp FAIL # libc++ doesn't implement LWG-4013 +std/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer.value/ctor.default.pass.cpp FAIL std/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer.value/ctor.iter.pass.cpp FAIL # If any feature-test macro test is failing, this consolidated test will also fail.