[libc++][ranges] LWG3505: split_view::outer-iterator::operator++ misspecified (#155160)

Implemented in LLVM15:
e53c461bf3

This LWG concerns`lazy_split_view` despite the outdated title.

Closes #104320

# References

- https://wg21.link/LWG3505
- https://wg21.link/range.lazy.split.outer

Co-authored-by: Hristo Hristov <zingam@outlook.com>
This commit is contained in:
Hristo Hristov
2025-11-14 06:08:17 +02:00
committed by GitHub
parent b196c52301
commit b71348415f
2 changed files with 51 additions and 1 deletions

View File

@@ -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|","","`#104316 <https://github.com/llvm/llvm-project/issues/104316>`__",""
"`LWG3500 <https://wg21.link/LWG3500>`__","``join_view::iterator::operator->()`` is bogus","2021-02 (Virtual)","|Complete|","14","`#104318 <https://github.com/llvm/llvm-project/issues/104318>`__",""
"`LWG3502 <https://wg21.link/LWG3502>`__","``elements_view`` should not be allowed to return dangling reference","2021-02 (Virtual)","|Complete|","16","`#104319 <https://github.com/llvm/llvm-project/issues/104319>`__",""
"`LWG3505 <https://wg21.link/LWG3505>`__","``split_view::outer-iterator::operator++`` misspecified","2021-02 (Virtual)","","","`#104320 <https://github.com/llvm/llvm-project/issues/104320>`__",""
"`LWG3505 <https://wg21.link/LWG3505>`__","``split_view::outer-iterator::operator++`` misspecified","2021-02 (Virtual)","|Complete|","15","`#104320 <https://github.com/llvm/llvm-project/issues/104320>`__",""
"","","","","","",""
"`LWG2774 <https://wg21.link/LWG2774>`__","``std::function`` construction vs assignment","2021-06 (Virtual)","","","`#104321 <https://github.com/llvm/llvm-project/issues/104321>`__",""
"`LWG2818 <https://wg21.link/LWG2818>`__","``::std::`` everywhere rule needs tweaking","2021-06 (Virtual)","|Nothing To Do|","","`#104322 <https://github.com/llvm/llvm-project/issues/104322>`__",""
1 Issue # Issue Name Meeting Status First released version GitHub issue Notes
58 `LWG3495 <https://wg21.link/LWG3495>`__ ``constexpr launder`` makes pointers to inactive members of unions usable 2021-02 (Virtual) |Nothing To Do| `#104316 <https://github.com/llvm/llvm-project/issues/104316>`__
59 `LWG3500 <https://wg21.link/LWG3500>`__ ``join_view::iterator::operator->()`` is bogus 2021-02 (Virtual) |Complete| 14 `#104318 <https://github.com/llvm/llvm-project/issues/104318>`__
60 `LWG3502 <https://wg21.link/LWG3502>`__ ``elements_view`` should not be allowed to return dangling reference 2021-02 (Virtual) |Complete| 16 `#104319 <https://github.com/llvm/llvm-project/issues/104319>`__
61 `LWG3505 <https://wg21.link/LWG3505>`__ ``split_view::outer-iterator::operator++`` misspecified 2021-02 (Virtual) |Complete| 15 `#104320 <https://github.com/llvm/llvm-project/issues/104320>`__
62
63 `LWG2774 <https://wg21.link/LWG2774>`__ ``std::function`` construction vs assignment 2021-06 (Virtual) `#104321 <https://github.com/llvm/llvm-project/issues/104321>`__
64 `LWG2818 <https://wg21.link/LWG2818>`__ ``::std::`` everywhere rule needs tweaking 2021-06 (Virtual) |Nothing To Do| `#104322 <https://github.com/llvm/llvm-project/issues/104322>`__

View File

@@ -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;
}