From 500a59f2c45aca502f5ecaeef9dbc985897036ac Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Sun, 18 Jun 2023 00:30:50 +0800 Subject: [PATCH] Implement LWG-3904 --- stl/inc/ranges | 2 +- tests/std/tests/P0896R4_views_lazy_split/test.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/stl/inc/ranges b/stl/inc/ranges index 753272269d..a9fa0e88f6 100644 --- a/stl/inc/ranges +++ b/stl/inc/ranges @@ -4596,7 +4596,7 @@ namespace ranges { constexpr _Outer_iter(_Outer_iter _It) requires _Const && convertible_to, iterator_t<_BaseTy>> - : _Mybase{_STD move(_It._Current)}, _Parent{_It._Parent} {} + : _Mybase{_STD move(_It._Current)}, _Parent{_It._Parent}, _Trailing_empty{_It._Trailing_empty} {} _NODISCARD constexpr auto operator*() const noexcept(noexcept(value_type{*this})) /* strengthened */ { return value_type{*this}; diff --git a/tests/std/tests/P0896R4_views_lazy_split/test.cpp b/tests/std/tests/P0896R4_views_lazy_split/test.cpp index 55a785f3e2..9616e3eb21 100644 --- a/tests/std/tests/P0896R4_views_lazy_split/test.cpp +++ b/tests/std/tests/P0896R4_views_lazy_split/test.cpp @@ -337,7 +337,18 @@ constexpr bool instantiation_test() { return true; } +constexpr bool test_lwg_3904() { + auto r = views::single(0) | views::lazy_split(0); + auto i = r.begin(); + ++i; + decltype(as_const(r).begin()) j = i; + return j != r.end(); +} + int main() { STATIC_ASSERT(instantiation_test()); instantiation_test(); + + STATIC_ASSERT(test_lwg_3904()); + assert(test_lwg_3904()); }