Skip to content

Commit e94dc78

Browse files
committed
Addresses review comments.
1 parent ecd6887 commit e94dc78

File tree

5 files changed

+10
-31
lines changed

5 files changed

+10
-31
lines changed

libcxx/include/__iterator/bounded_iter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ struct __bounded_iter {
211211
}
212212
#endif
213213

214+
// TODO(mordante) disable these overloads in the LLVM 20 release.
214215
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR friend bool
215216
operator<(__bounded_iter const& __x, __bounded_iter const& __y) _NOEXCEPT {
216217
return __x.__current_ < __y.__current_;

libcxx/include/__iterator/wrap_iter.h

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX
147147
}
148148
#endif
149149

150+
// TODO(mordante) disable these overloads in the LLVM 20 release.
150151
template <class _Iter1>
151152
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
152153
operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT {
@@ -184,23 +185,6 @@ operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX
184185
}
185186

186187
#if _LIBCPP_STD_VER >= 20
187-
188-
template <class _Iter1>
189-
_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering
190-
operator<=>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) noexcept {
191-
if constexpr (three_way_comparable<_Iter1, strong_ordering>) {
192-
return __x.base() <=> __y.base();
193-
} else {
194-
if (__x.base() < __y.base())
195-
return strong_ordering::less;
196-
197-
if (__x.base() == __y.base())
198-
return strong_ordering::equal;
199-
200-
return strong_ordering::greater;
201-
}
202-
}
203-
204188
template <class _Iter1, class _Iter2>
205189
_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering
206190
operator<=>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) noexcept {
@@ -216,7 +200,6 @@ operator<=>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) noex
216200
return strong_ordering::greater;
217201
}
218202
}
219-
220203
#endif // _LIBCPP_STD_VER >= 20
221204

222205
template <class _Iter1, class _Iter2>

libcxx/include/deque

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ public:
382382
}
383383
#endif
384384

385+
// TODO(mordante) disable these overloads in the LLVM 20 release.
385386
_LIBCPP_HIDE_FROM_ABI friend bool operator<(const __deque_iterator& __x, const __deque_iterator& __y) {
386387
return __x.__m_iter_ < __y.__m_iter_ || (__x.__m_iter_ == __y.__m_iter_ && __x.__ptr_ < __y.__ptr_);
387388
}
@@ -399,7 +400,6 @@ public:
399400
}
400401

401402
#if _LIBCPP_STD_VER >= 20
402-
// template <class _Tp = void>
403403
_LIBCPP_HIDE_FROM_ABI friend strong_ordering operator<=>(const __deque_iterator& __x, const __deque_iterator& __y) {
404404
if (__x.__m_iter_ < __y.__m_iter_)
405405
return strong_ordering::less;

libcxx/test/libcxx/iterators/bounded_iter/comparison.pass.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,9 @@ TEST_CONSTEXPR_CXX14 bool tests() {
6161
}
6262

6363
#if TEST_STD_VER >= 20
64-
if constexpr (requires(std::__bounded_iter<Iter> const iter) {
65-
{ iter <=> iter } -> std::same_as<std::strong_ordering>;
66-
}) {
67-
// P1614
68-
std::same_as<std::strong_ordering> decltype(auto) r1 = iter1 <=> iter2;
69-
assert(r1 == std::strong_ordering::less);
70-
}
64+
// P1614
65+
std::same_as<std::strong_ordering> decltype(auto) r1 = iter1 <=> iter2;
66+
assert(r1 == std::strong_ordering::less);
7167
#endif
7268

7369
return true;

libcxx/test/std/containers/views/views.span/span.iterators/iterator.pass.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@
2222
#include "test_macros.h"
2323

2424
template <class T>
25-
TEST_CONSTEXPR void test_type() {
26-
#
27-
25+
constexpr void test_type() {
2826
using C = std::span<T>;
2927
typename C::iterator ii1{}, ii2{};
3028
typename C::iterator ii4 = ii1;
3129
// TODO Test against C++23 after implementing
32-
// P2278R4 cbegin should always return a constant iterator
30+
// P2278R4 cbegin should always return a constant iterator
31+
// The means adjusting the #ifdef to guard against C++23.
3332
#ifdef __cpp_lib_ranges_as_const
3433
typename C::const_iterator cii{};
3534
#endif
@@ -77,7 +76,7 @@ TEST_CONSTEXPR void test_type() {
7776
#endif
7877
}
7978

80-
TEST_CONSTEXPR bool test() {
79+
constexpr bool test() {
8180
test_type<char>();
8281
test_type<int>();
8382
test_type<std::string>();

0 commit comments

Comments
 (0)