Skip to content

Conversation

H-G-Hristov
Copy link
Contributor

@H-G-Hristov H-G-Hristov commented Aug 24, 2025

Implented in LLVM15: e53c461

This LWG concernslazy_split_view despite the outdated title.

Closes #104320

References

@H-G-Hristov H-G-Hristov requested a review from a team as a code owner August 24, 2025 11:44
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Aug 24, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 24, 2025

@llvm/pr-subscribers-libcxx

Author: Hristo Hristov (H-G-Hristov)

Changes

Implented in LLVM15: e53c461

Fixes #104320


Full diff: https://github.com/llvm/llvm-project/pull/155160.diff

2 Files Affected:

  • (modified) libcxx/docs/Status/Cxx23Issues.csv (+1-1)
  • (modified) libcxx/test/std/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer/increment.pass.cpp (+50)
diff --git a/libcxx/docs/Status/Cxx23Issues.csv b/libcxx/docs/Status/Cxx23Issues.csv
index 189f8452e0678..85acbb09f518a 100644
--- a/libcxx/docs/Status/Cxx23Issues.csv
+++ b/libcxx/docs/Status/Cxx23Issues.csv
@@ -58,7 +58,7 @@
 "`LWG3495 <https://wg21.link/LWG3495>`__","``constexpr launder`` makes pointers to inactive members of unions usable","2021-02 (Virtual)","|Nothing To Do|","",""
 "`LWG3500 <https://wg21.link/LWG3500>`__","``join_view::iterator::operator->()`` is bogus","2021-02 (Virtual)","|Complete|","14",""
 "`LWG3502 <https://wg21.link/LWG3502>`__","``elements_view`` should not be allowed to return dangling reference","2021-02 (Virtual)","|Complete|","16",""
-"`LWG3505 <https://wg21.link/LWG3505>`__","``split_view::outer-iterator::operator++`` misspecified","2021-02 (Virtual)","","",""
+"`LWG3505 <https://wg21.link/LWG3505>`__","``split_view::outer-iterator::operator++`` misspecified","2021-02 (Virtual)","|Complete|","15",""
 "","","","","",""
 "`LWG2774 <https://wg21.link/LWG2774>`__","``std::function`` construction vs assignment","2021-06 (Virtual)","","",""
 "`LWG2818 <https://wg21.link/LWG2818>`__","``::std::`` everywhere rule needs tweaking","2021-06 (Virtual)","|Nothing To Do|","",""
diff --git a/libcxx/test/std/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer/increment.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer/increment.pass.cpp
index 4d765d71407f5..b557346588306 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer/increment.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.lazy.split/range.lazy.split.outer/increment.pass.cpp
@@ -75,6 +75,56 @@ constexpr bool test() {
     }
   }
 
+  // LWG3505
+  {
+    using namespace std::string_view_literals;
+
+    { // Motivational example
+      auto v = std::views::lazy_split("xxyx"sv, "xy"sv);
+
+      {
+        auto i = v.begin();
+        assert(std::ranges::equal(*i, "x"s));
+
+        decltype(auto) i2 = ++i;
+        static_assert(std::is_lvalue_reference_v<decltype(i2)>);
+        assert(std::ranges::equal(*i2, "x"s));
+      }
+
+      {
+        auto i = v.begin();
+        assert(std::ranges::equal(*i, "x"s));
+
+        decltype(auto) i2 = i++;
+        static_assert(!std::is_reference_v<decltype(i2)>);
+        assert(std::ranges::equal(*i2, "x"s));
+        assert(std::ranges::equal(*i, "x"s));
+      }
+    }
+    {
+      auto v = std::views::lazy_split("zzht"sv, "zh"sv);
+
+      {
+        auto i = v.begin();
+        assert(std::ranges::equal(*i, "z"s));
+
+        decltype(auto) i2 = ++i;
+        static_assert(std::is_lvalue_reference_v<decltype(i2)>);
+        assert(std::ranges::equal(*i2, "t"s));
+      }
+
+      {
+        auto i = v.begin();
+        assert(std::ranges::equal(*i, "z"s));
+
+        decltype(auto) i2 = i++;
+        static_assert(!std::is_reference_v<decltype(i2)>);
+        assert(std::ranges::equal(*i2, "z"s));
+        assert(std::ranges::equal(*i, "t"s));
+      }
+    }
+  }
+
   return true;
 }
 

@H-G-Hristov H-G-Hristov changed the title [libc++][ranges] LWG3505: split_view::outer-iterator::operator++ misspecified [libc++][ranges] LWG3505: split_view::outer-iterator::operator++ misspecified Aug 24, 2025
@Zingam Zingam added the ranges Issues related to `<ranges>` label Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. ranges Issues related to `<ranges>`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LWG3505: split_view::outer-iterator::operator++ misspecified
3 participants