[libcxx-commits] [libcxx] 4ea850b - [libc++] Remove __unconstrained_reverse_iterator (#85582)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Mar 18 06:19:56 PDT 2024
Author: Nikolas Klauser
Date: 2024-03-18T14:19:51+01:00
New Revision: 4ea850b52ffbb6ca6a40242558ee005a2a894daf
URL: https://github.com/llvm/llvm-project/commit/4ea850b52ffbb6ca6a40242558ee005a2a894daf
DIFF: https://github.com/llvm/llvm-project/commit/4ea850b52ffbb6ca6a40242558ee005a2a894daf.diff
LOG: [libc++] Remove __unconstrained_reverse_iterator (#85582)
`__unconstrained_reverse_iterator` has outlived its usefullness, since
the standard and subsequently the compilers have been fixed.
Added:
Modified:
libcxx/include/__algorithm/inplace_merge.h
libcxx/include/__iterator/reverse_iterator.h
Removed:
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/equal.pass.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/greater-equal.pass.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/greater.pass.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/less-equal.pass.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/less.pass.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/not-equal.pass.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cons/assign.LWG3435.verify.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cons/ctor.default.pass.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cons/ctor.iter.explicit.verify.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cons/ctor.iter.pass.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cons/ctor.reverse_iterator.LWG3435.verify.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.conv/base.pass.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.elem/arrow.pass.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.elem/bracket.pass.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.elem/dereference.pass.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/decrement-assign.pass.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/increment-assign.pass.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/minus.pass.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/plus.pass.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/postdecrement.pass.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/postincrement.pass.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/predecrement.pass.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/preincrement.pass.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nonmember/minus.pass.cpp
libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/types.compile.pass.cpp
################################################################################
diff --git a/libcxx/include/__algorithm/inplace_merge.h b/libcxx/include/__algorithm/inplace_merge.h
index eb3c0bdbc2db7f..a6bcc66a2fa47a 100644
--- a/libcxx/include/__algorithm/inplace_merge.h
+++ b/libcxx/include/__algorithm/inplace_merge.h
@@ -114,8 +114,8 @@ _LIBCPP_HIDE_FROM_ABI void __buffered_inplace_merge(
for (_BidirectionalIterator __i = __middle; __i != __last;
__d.template __incr<value_type>(), (void)++__i, (void)++__p)
::new ((void*)__p) value_type(_IterOps<_AlgPolicy>::__iter_move(__i));
- typedef __unconstrained_reverse_iterator<_BidirectionalIterator> _RBi;
- typedef __unconstrained_reverse_iterator<value_type*> _Rv;
+ typedef reverse_iterator<_BidirectionalIterator> _RBi;
+ typedef reverse_iterator<value_type*> _Rv;
typedef __invert<_Compare> _Inverted;
std::__half_inplace_merge<_AlgPolicy>(
_Rv(__p), _Rv(__buff), _RBi(__middle), _RBi(__first), _RBi(__last), _Inverted(__comp));
diff --git a/libcxx/include/__iterator/reverse_iterator.h b/libcxx/include/__iterator/reverse_iterator.h
index 9aab96866f4fa1..2ae14619348536 100644
--- a/libcxx/include/__iterator/reverse_iterator.h
+++ b/libcxx/include/__iterator/reverse_iterator.h
@@ -316,172 +316,6 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Ite
}
#endif
-#if _LIBCPP_STD_VER <= 17
-template <class _Iter>
-using __unconstrained_reverse_iterator = reverse_iterator<_Iter>;
-#else
-
-// __unconstrained_reverse_iterator allows us to use reverse iterators in the implementation of algorithms by working
-// around a language issue in C++20.
-// In C++20, when a reverse iterator wraps certain C++20-hostile iterators, calling comparison operators on it will
-// result in a compilation error. However, calling comparison operators on the pristine hostile iterator is not
-// an error. Thus, we cannot use reverse_iterators in the implementation of an algorithm that accepts a
-// C++20-hostile iterator. This class is an internal workaround -- it is a copy of reverse_iterator with
-// tweaks to make it support hostile iterators.
-//
-// A C++20-hostile iterator is one that defines a comparison operator where one of the arguments is an exact match
-// and the other requires an implicit conversion, for example:
-// friend bool operator==(const BaseIter&, const DerivedIter&);
-//
-// C++20 rules for rewriting equality operators create another overload of this function with parameters reversed:
-// friend bool operator==(const DerivedIter&, const BaseIter&);
-//
-// This creates an ambiguity in overload resolution.
-//
-// Clang treats this ambiguity
diff erently in
diff erent contexts. When operator== is actually called in the function
-// body, the code is accepted with a warning. When a concept requires operator== to be a valid expression, however,
-// it evaluates to false. Thus, the implementation of reverse_iterator::operator== can actually call operator== on its
-// base iterators, but the constraints on reverse_iterator::operator== prevent it from being considered during overload
-// resolution. This class simply removes the problematic constraints from comparison functions.
-template <class _Iter>
-class __unconstrained_reverse_iterator {
- _Iter __iter_;
-
-public:
- static_assert(__has_bidirectional_iterator_category<_Iter>::value || bidirectional_iterator<_Iter>);
-
- using iterator_type = _Iter;
- using iterator_category =
- _If<__has_random_access_iterator_category<_Iter>::value,
- random_access_iterator_tag,
- __iterator_category_type<_Iter>>;
- using pointer = __iterator_pointer_type<_Iter>;
- using value_type = iter_value_t<_Iter>;
- using
diff erence_type = iter_
diff erence_t<_Iter>;
- using reference = iter_reference_t<_Iter>;
-
- _LIBCPP_HIDE_FROM_ABI constexpr __unconstrained_reverse_iterator() = default;
- _LIBCPP_HIDE_FROM_ABI constexpr __unconstrained_reverse_iterator(const __unconstrained_reverse_iterator&) = default;
- _LIBCPP_HIDE_FROM_ABI constexpr explicit __unconstrained_reverse_iterator(_Iter __iter) : __iter_(__iter) {}
-
- _LIBCPP_HIDE_FROM_ABI constexpr _Iter base() const { return __iter_; }
- _LIBCPP_HIDE_FROM_ABI constexpr reference operator*() const {
- auto __tmp = __iter_;
- return *--__tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr pointer operator->() const {
- if constexpr (is_pointer_v<_Iter>) {
- return std::prev(__iter_);
- } else {
- return std::prev(__iter_).operator->();
- }
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter>
- iter_move(const __unconstrained_reverse_iterator& __i) noexcept(
- is_nothrow_copy_constructible_v<_Iter>&& noexcept(ranges::iter_move(--std::declval<_Iter&>()))) {
- auto __tmp = __i.base();
- return ranges::iter_move(--__tmp);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __unconstrained_reverse_iterator& operator++() {
- --__iter_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __unconstrained_reverse_iterator operator++(int) {
- auto __tmp = *this;
- --__iter_;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __unconstrained_reverse_iterator& operator--() {
- ++__iter_;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __unconstrained_reverse_iterator operator--(int) {
- auto __tmp = *this;
- ++__iter_;
- return __tmp;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __unconstrained_reverse_iterator& operator+=(
diff erence_type __n) {
- __iter_ -= __n;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __unconstrained_reverse_iterator& operator-=(
diff erence_type __n) {
- __iter_ += __n;
- return *this;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __unconstrained_reverse_iterator operator+(
diff erence_type __n) const {
- return __unconstrained_reverse_iterator(__iter_ - __n);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr __unconstrained_reverse_iterator operator-(
diff erence_type __n) const {
- return __unconstrained_reverse_iterator(__iter_ + __n);
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr
diff erence_type operator-(const __unconstrained_reverse_iterator& __other) const {
- return __other.__iter_ - __iter_;
- }
-
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator[](
diff erence_type __n) const { return *(*this + __n); }
-
- // Deliberately unconstrained unlike the comparison functions in `reverse_iterator` -- see the class comment for the
- // rationale.
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool
- operator==(const __unconstrained_reverse_iterator& __lhs, const __unconstrained_reverse_iterator& __rhs) {
- return __lhs.base() == __rhs.base();
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool
- operator!=(const __unconstrained_reverse_iterator& __lhs, const __unconstrained_reverse_iterator& __rhs) {
- return __lhs.base() != __rhs.base();
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool
- operator<(const __unconstrained_reverse_iterator& __lhs, const __unconstrained_reverse_iterator& __rhs) {
- return __lhs.base() > __rhs.base();
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool
- operator>(const __unconstrained_reverse_iterator& __lhs, const __unconstrained_reverse_iterator& __rhs) {
- return __lhs.base() < __rhs.base();
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool
- operator<=(const __unconstrained_reverse_iterator& __lhs, const __unconstrained_reverse_iterator& __rhs) {
- return __lhs.base() >= __rhs.base();
- }
-
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool
- operator>=(const __unconstrained_reverse_iterator& __lhs, const __unconstrained_reverse_iterator& __rhs) {
- return __lhs.base() <= __rhs.base();
- }
-};
-
-#endif // _LIBCPP_STD_VER <= 17
-
-template <template <class> class _RevIter1, template <class> class _RevIter2, class _Iter>
-struct __unwrap_reverse_iter_impl {
- using _UnwrappedIter = decltype(__unwrap_iter_impl<_Iter>::__unwrap(std::declval<_Iter>()));
- using _ReverseWrapper = _RevIter1<_RevIter2<_Iter> >;
-
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ReverseWrapper
- __rewrap(_ReverseWrapper __orig_iter, _UnwrappedIter __unwrapped_iter) {
- return _ReverseWrapper(
- _RevIter2<_Iter>(__unwrap_iter_impl<_Iter>::__rewrap(__orig_iter.base().base(), __unwrapped_iter)));
- }
-
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _UnwrappedIter __unwrap(_ReverseWrapper __i) _NOEXCEPT {
- return __unwrap_iter_impl<_Iter>::__unwrap(__i.base().base());
- }
-};
-
#if _LIBCPP_STD_VER >= 20
template <ranges::bidirectional_range _Range>
_LIBCPP_HIDE_FROM_ABI constexpr ranges::subrange<reverse_iterator<ranges::iterator_t<_Range>>,
@@ -493,24 +327,20 @@ __reverse_range(_Range&& __range) {
#endif
template <class _Iter, bool __b>
-struct __unwrap_iter_impl<reverse_iterator<reverse_iterator<_Iter> >, __b>
- : __unwrap_reverse_iter_impl<reverse_iterator, reverse_iterator, _Iter> {};
-
-#if _LIBCPP_STD_VER >= 20
-
-template <class _Iter, bool __b>
-struct __unwrap_iter_impl<reverse_iterator<__unconstrained_reverse_iterator<_Iter>>, __b>
- : __unwrap_reverse_iter_impl<reverse_iterator, __unconstrained_reverse_iterator, _Iter> {};
-
-template <class _Iter, bool __b>
-struct __unwrap_iter_impl<__unconstrained_reverse_iterator<reverse_iterator<_Iter>>, __b>
- : __unwrap_reverse_iter_impl<__unconstrained_reverse_iterator, reverse_iterator, _Iter> {};
+struct __unwrap_iter_impl<reverse_iterator<reverse_iterator<_Iter> >, __b> {
+ using _UnwrappedIter = decltype(__unwrap_iter_impl<_Iter>::__unwrap(std::declval<_Iter>()));
+ using _ReverseWrapper = reverse_iterator<reverse_iterator<_Iter> >;
-template <class _Iter, bool __b>
-struct __unwrap_iter_impl<__unconstrained_reverse_iterator<__unconstrained_reverse_iterator<_Iter>>, __b>
- : __unwrap_reverse_iter_impl<__unconstrained_reverse_iterator, __unconstrained_reverse_iterator, _Iter> {};
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ReverseWrapper
+ __rewrap(_ReverseWrapper __orig_iter, _UnwrappedIter __unwrapped_iter) {
+ return _ReverseWrapper(
+ reverse_iterator<_Iter>(__unwrap_iter_impl<_Iter>::__rewrap(__orig_iter.base().base(), __unwrapped_iter)));
+ }
-#endif // _LIBCPP_STD_VER >= 20
+ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _UnwrappedIter __unwrap(_ReverseWrapper __i) _NOEXCEPT {
+ return __unwrap_iter_impl<_Iter>::__unwrap(__i.base().base());
+ }
+};
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/equal.pass.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/equal.pass.cpp
deleted file mode 100644
index 583e733c07cb0b..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/equal.pass.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// template <BidirectionalIterator Iter1, BidirectionalIterator Iter2>
-// requires HasEqualTo<Iter1, Iter2>
-// bool operator==(const __unconstrained_reverse_iterator<Iter1>& x, const __unconstrained_reverse_iterator<Iter2>& y); // constexpr since C++17
-
-#include <iterator>
-#include <cassert>
-
-#include "test_macros.h"
-#include "test_iterators.h"
-
-template <class It>
-TEST_CONSTEXPR_CXX17 void test(It l, It r, bool x) {
- const std::__unconstrained_reverse_iterator<It> r1(l);
- const std::__unconstrained_reverse_iterator<It> r2(r);
- assert((r1 == r2) == x);
-}
-
-TEST_CONSTEXPR_CXX17 bool tests() {
- const char* s = "1234567890";
- test(bidirectional_iterator<const char*>(s), bidirectional_iterator<const char*>(s), true);
- test(bidirectional_iterator<const char*>(s), bidirectional_iterator<const char*>(s+1), false);
- test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s), true);
- test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1), false);
- test(s, s, true);
- test(s, s+1, false);
- return true;
-}
-
-int main(int, char**) {
- tests();
-#if TEST_STD_VER > 14
- static_assert(tests(), "");
-#endif
- return 0;
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/greater-equal.pass.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/greater-equal.pass.cpp
deleted file mode 100644
index 9e908418d07565..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/greater-equal.pass.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// template <RandomAccessIterator Iter1, RandomAccessIterator Iter2>
-// requires HasGreater<Iter1, Iter2>
-// bool operator>=(const __unconstrained_reverse_iterator<Iter1>& x, const __unconstrained_reverse_iterator<Iter2>& y); // constexpr since C++17
-
-#include <iterator>
-#include <cassert>
-
-#include "test_macros.h"
-#include "test_iterators.h"
-
-template <class It>
-TEST_CONSTEXPR_CXX17 void test(It l, It r, bool x) {
- const std::__unconstrained_reverse_iterator<It> r1(l);
- const std::__unconstrained_reverse_iterator<It> r2(r);
- assert((r1 >= r2) == x);
-}
-
-TEST_CONSTEXPR_CXX17 bool tests() {
- const char* s = "1234567890";
- test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s), true);
- test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1), true);
- test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s), false);
- test(s, s, true);
- test(s, s+1, true);
- test(s+1, s, false);
- return true;
-}
-
-int main(int, char**) {
- tests();
-#if TEST_STD_VER > 14
- static_assert(tests(), "");
-#endif
- return 0;
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/greater.pass.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/greater.pass.cpp
deleted file mode 100644
index f1afd23bab1338..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/greater.pass.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// template <RandomAccessIterator Iter1, RandomAccessIterator Iter2>
-// requires HasGreater<Iter1, Iter2>
-// bool operator>(const __unconstrained_reverse_iterator<Iter1>& x, const __unconstrained_reverse_iterator<Iter2>& y); // constexpr in C++17
-
-#include <iterator>
-#include <cassert>
-
-#include "test_macros.h"
-#include "test_iterators.h"
-
-template <class It>
-TEST_CONSTEXPR_CXX17 void test(It l, It r, bool x) {
- const std::__unconstrained_reverse_iterator<It> r1(l);
- const std::__unconstrained_reverse_iterator<It> r2(r);
- assert((r1 > r2) == x);
-}
-
-TEST_CONSTEXPR_CXX17 bool tests() {
- const char* s = "1234567890";
- test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s), false);
- test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1), true);
- test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s), false);
- test(s, s, false);
- test(s, s+1, true);
- test(s+1, s, false);
- return true;
-}
-
-int main(int, char**) {
- tests();
-#if TEST_STD_VER > 14
- static_assert(tests(), "");
-#endif
- return 0;
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/less-equal.pass.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/less-equal.pass.cpp
deleted file mode 100644
index c710212308fac7..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/less-equal.pass.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// template <RandomAccessIterator Iter1, RandomAccessIterator Iter2>
-// requires HasGreater<Iter1, Iter2>
-// bool operator<=(const __unconstrained_reverse_iterator<Iter1>& x, const __unconstrained_reverse_iterator<Iter2>& y); // constexpr in C++17
-
-#include <iterator>
-#include <cassert>
-
-#include "test_macros.h"
-#include "test_iterators.h"
-
-template <class It>
-TEST_CONSTEXPR_CXX17 void test(It l, It r, bool x) {
- const std::__unconstrained_reverse_iterator<It> r1(l);
- const std::__unconstrained_reverse_iterator<It> r2(r);
- assert((r1 <= r2) == x);
-}
-
-TEST_CONSTEXPR_CXX17 bool tests() {
- const char* s = "1234567890";
- test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s), true);
- test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1), false);
- test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s), true);
- test(s, s, true);
- test(s, s+1, false);
- test(s+1, s, true);
- return true;
-}
-
-int main(int, char**) {
- tests();
-#if TEST_STD_VER > 14
- static_assert(tests(), "");
-#endif
- return 0;
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/less.pass.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/less.pass.cpp
deleted file mode 100644
index ffd3a0323373fb..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/less.pass.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// template <RandomAccessIterator Iter1, RandomAccessIterator Iter2>
-// requires HasGreater<Iter1, Iter2>
-// bool operator<(const __unconstrained_reverse_iterator<Iter1>& x, const __unconstrained_reverse_iterator<Iter2>& y); // constexpr in C++17
-
-#include <iterator>
-#include <cassert>
-
-#include "test_macros.h"
-#include "test_iterators.h"
-
-template <class It>
-TEST_CONSTEXPR_CXX17 void test(It l, It r, bool x) {
- const std::__unconstrained_reverse_iterator<It> r1(l);
- const std::__unconstrained_reverse_iterator<It> r2(r);
- assert((r1 < r2) == x);
-}
-
-TEST_CONSTEXPR_CXX17 bool tests() {
- const char* s = "1234567890";
- test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s), false);
- test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1), false);
- test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s), true);
- test(s, s, false);
- test(s, s+1, false);
- test(s+1, s, true);
- return true;
-}
-
-int main(int, char**) {
- tests();
-#if TEST_STD_VER > 14
- static_assert(tests(), "");
-#endif
- return 0;
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/not-equal.pass.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/not-equal.pass.cpp
deleted file mode 100644
index 614f159cc80522..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cmp/not-equal.pass.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// template <BidirectionalIterator Iter1, BidirectionalIterator Iter2>
-// requires HasEqualTo<Iter1, Iter2>
-// bool operator!=(const __unconstrained_reverse_iterator<Iter1>& x, const __unconstrained_reverse_iterator<Iter2>& y); // constexpr in C++17
-
-#include <iterator>
-#include <cassert>
-
-#include "test_macros.h"
-#include "test_iterators.h"
-
-template <class It>
-TEST_CONSTEXPR_CXX17 void test(It l, It r, bool x) {
- const std::__unconstrained_reverse_iterator<It> r1(l);
- const std::__unconstrained_reverse_iterator<It> r2(r);
- assert((r1 != r2) == x);
-}
-
-TEST_CONSTEXPR_CXX17 bool tests() {
- const char* s = "1234567890";
- test(bidirectional_iterator<const char*>(s), bidirectional_iterator<const char*>(s), false);
- test(bidirectional_iterator<const char*>(s), bidirectional_iterator<const char*>(s+1), true);
- test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s), false);
- test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1), true);
- test(s, s, false);
- test(s, s+1, true);
- return true;
-}
-
-int main(int, char**) {
- tests();
-#if TEST_STD_VER > 14
- static_assert(tests(), "");
-#endif
- return 0;
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cons/assign.LWG3435.verify.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cons/assign.LWG3435.verify.cpp
deleted file mode 100644
index 835e2b65c19c20..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cons/assign.LWG3435.verify.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// template <class U>
-// requires !same_as<U, Iter> && convertible_to<const U&, Iter> && assignable_from<Iter&, const U&>
-// __unconstrained_reverse_iterator& operator=(const __unconstrained_reverse_iterator<U>& u);
-
-#include <iterator>
-
-struct Base { };
-struct Derived : Base { };
-
-void test() {
- std::__unconstrained_reverse_iterator<Base*> base;
- std::__unconstrained_reverse_iterator<Derived*> derived;
- derived = base; // expected-error {{no viable overloaded '='}}
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cons/ctor.default.pass.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cons/ctor.default.pass.cpp
deleted file mode 100644
index 66972d7243cc83..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cons/ctor.default.pass.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// __unconstrained_reverse_iterator(); // constexpr since C++17
-
-#include <iterator>
-
-#include "test_macros.h"
-#include "test_iterators.h"
-
-template <class It>
-TEST_CONSTEXPR_CXX17 void test() {
- std::__unconstrained_reverse_iterator<It> r;
- (void)r;
-}
-
-TEST_CONSTEXPR_CXX17 bool tests() {
- test<bidirectional_iterator<const char*> >();
- test<random_access_iterator<char*> >();
- test<char*>();
- test<const char*>();
- return true;
-}
-
-int main(int, char**) {
- tests();
-#if TEST_STD_VER > 14
- static_assert(tests(), "");
-#endif
- return 0;
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cons/ctor.iter.explicit.verify.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cons/ctor.iter.explicit.verify.cpp
deleted file mode 100644
index 6440e284f6a016..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cons/ctor.iter.explicit.verify.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// explicit __unconstrained_reverse_iterator(Iter x);
-
-// test explicitness
-
-#include <iterator>
-
-void f() {
- char const* it = "";
- std::__unconstrained_reverse_iterator<char const*> r = it; // expected-error{{no viable conversion from 'const char *' to 'std::__unconstrained_reverse_iterator<const char *>'}}
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cons/ctor.iter.pass.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cons/ctor.iter.pass.cpp
deleted file mode 100644
index e4d0874d50b5e9..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cons/ctor.iter.pass.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// explicit __unconstrained_reverse_iterator(Iter x); // constexpr since C++17
-
-#include <iterator>
-#include <cassert>
-
-#include "test_macros.h"
-#include "test_iterators.h"
-
-template <class It>
-TEST_CONSTEXPR_CXX17 void test(It i) {
- std::__unconstrained_reverse_iterator<It> r(i);
- assert(r.base() == i);
-}
-
-TEST_CONSTEXPR_CXX17 bool tests() {
- const char s[] = "123";
- test(bidirectional_iterator<const char*>(s));
- test(random_access_iterator<const char*>(s));
- test(s);
- return true;
-}
-
-int main(int, char**) {
- tests();
-#if TEST_STD_VER > 14
- static_assert(tests(), "");
-#endif
- return 0;
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cons/ctor.reverse_iterator.LWG3435.verify.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cons/ctor.reverse_iterator.LWG3435.verify.cpp
deleted file mode 100644
index 7ea4a61ce66020..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.cons/ctor.reverse_iterator.LWG3435.verify.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// template <class U>
-// requires !same_as<U, Iter> && convertible_to<const U&, Iter>
-// __unconstrained_reverse_iterator(const __unconstrained_reverse_iterator<U> &);
-
-#include <iterator>
-
-struct Base { };
-struct Derived : Base { };
-
-void test() {
- std::__unconstrained_reverse_iterator<Base*> base;
- std::__unconstrained_reverse_iterator<Derived*> derived(base); // expected-error {{no matching constructor for initialization of 'std::__unconstrained_reverse_iterator<Derived *>'}}
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.conv/base.pass.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.conv/base.pass.cpp
deleted file mode 100644
index 7fd85c92b32771..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.conv/base.pass.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// iterator_type base() const; // constexpr since C++17
-
-#include <iterator>
-#include <cassert>
-
-#include "test_macros.h"
-#include "test_iterators.h"
-
-TEST_CONSTEXPR_CXX17 bool test() {
- typedef bidirectional_iterator<int*> Iter;
- int i = 0;
- Iter iter(&i);
- std::__unconstrained_reverse_iterator<Iter> const reverse(iter);
- std::__unconstrained_reverse_iterator<Iter>::iterator_type base = reverse.base();
- assert(base == Iter(&i));
- return true;
-}
-
-int main(int, char**) {
- test();
-#if TEST_STD_VER > 14
- static_assert(test(), "");
-#endif
- return 0;
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.elem/arrow.pass.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.elem/arrow.pass.cpp
deleted file mode 100644
index f0a181bcba88f1..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.elem/arrow.pass.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// pointer operator->() const; // constexpr in C++17
-
-// Be sure to respect LWG 198:
-// http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#198
-// LWG 198 was superseded by LWG 2360
-// http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2360
-
-
-#include <iterator>
-#include <list>
-#include <cassert>
-
-#include "test_macros.h"
-
-class A
-{
- int data_;
-public:
- A() : data_(1) {}
- A(const A&) = default;
- A& operator=(const A&) = default;
- ~A() {data_ = -1;}
-
- int get() const {return data_;}
-
- friend bool operator==(const A& x, const A& y)
- {return x.data_ == y.data_;}
-};
-
-template <class It>
-void
-test(It i, typename std::iterator_traits<It>::value_type x)
-{
- std::__unconstrained_reverse_iterator<It> r(i);
- assert(r->get() == x.get());
-}
-
-class B
-{
- int data_;
-public:
- B(int d=1) : data_(d) {}
- B(const B&) = default;
- B& operator=(const B&) = default;
- ~B() {data_ = -1;}
-
- int get() const {return data_;}
-
- friend bool operator==(const B& x, const B& y)
- {return x.data_ == y.data_;}
- const B *operator&() const { return nullptr; }
- B *operator&() { return nullptr; }
-};
-
-class C
-{
- int data_;
-public:
- TEST_CONSTEXPR C() : data_(1) {}
-
- TEST_CONSTEXPR int get() const {return data_;}
-
- friend TEST_CONSTEXPR bool operator==(const C& x, const C& y)
- {return x.data_ == y.data_;}
-};
-
-TEST_CONSTEXPR C gC;
-
-int main(int, char**)
-{
- A a;
- test(&a+1, A());
-
- {
- std::list<B> l;
- l.push_back(B(0));
- l.push_back(B(1));
- l.push_back(B(2));
-
- {
- std::list<B>::const_iterator i = l.begin();
- assert ( i->get() == 0 ); ++i;
- assert ( i->get() == 1 ); ++i;
- assert ( i->get() == 2 ); ++i;
- assert ( i == l.end ());
- }
-
- {
- std::list<B>::const_reverse_iterator ri = l.rbegin();
- assert ( ri->get() == 2 ); ++ri;
- assert ( ri->get() == 1 ); ++ri;
- assert ( ri->get() == 0 ); ++ri;
- assert ( ri == l.rend ());
- }
- }
-
-#if TEST_STD_VER > 14
- {
- typedef std::__unconstrained_reverse_iterator<const C *> RI;
- constexpr RI it1 = RI(&gC+1);
-
- static_assert(it1->get() == gC.get(), "");
- }
-#endif
- {
- ((void)gC);
- }
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.elem/bracket.pass.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.elem/bracket.pass.cpp
deleted file mode 100644
index f9beada9e4e64b..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.elem/bracket.pass.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// requires RandomAccessIterator<Iter>
-// unspecified operator[](
diff erence_type n) const; // constexpr since C++17
-
-#include <iterator>
-#include <cassert>
-
-#include "test_macros.h"
-#include "test_iterators.h"
-
-template <class It>
-TEST_CONSTEXPR_CXX17 void test(It i,
- typename std::iterator_traits<It>::
diff erence_type n,
- typename std::iterator_traits<It>::value_type x) {
- typedef typename std::iterator_traits<It>::value_type value_type;
- const std::__unconstrained_reverse_iterator<It> r(i);
- value_type rr = r[n];
- assert(rr == x);
-}
-
-TEST_CONSTEXPR_CXX17 bool tests() {
- const char* s = "1234567890";
- test(random_access_iterator<const char*>(s+5), 4, '1');
- test(random_access_iterator<const char*>(s+5), 0, '5');
- test(s+5, 4, '1');
- test(s+5, 0, '5');
- return true;
-}
-
-int main(int, char**) {
- tests();
-#if TEST_STD_VER > 14
- static_assert(tests(), "");
-#endif
- return 0;
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.elem/dereference.pass.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.elem/dereference.pass.cpp
deleted file mode 100644
index bd6b6e0df038de..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.elem/dereference.pass.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// reference operator*() const; // constexpr in C++17
-
-// Be sure to respect LWG 198:
-// http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#198
-// LWG 198 was superseded by LWG 2360
-// http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2360
-
-#include <iterator>
-#include <cassert>
-
-#include "test_macros.h"
-
-class A
-{
- int data_;
-public:
- A() : data_(1) {}
- A(const A&) = default;
- A& operator=(const A&) = default;
- ~A() {data_ = -1;}
-
- friend bool operator==(const A& x, const A& y)
- {return x.data_ == y.data_;}
-};
-
-template <class It>
-void
-test(It i, typename std::iterator_traits<It>::value_type x)
-{
- std::__unconstrained_reverse_iterator<It> r(i);
- assert(*r == x);
-}
-
-int main(int, char**)
-{
- A a;
- test(&a+1, A());
-
-#if TEST_STD_VER > 14
- {
- constexpr const char *p = "123456789";
- typedef std::__unconstrained_reverse_iterator<const char *> RI;
- constexpr RI it1 = RI(p+1);
- constexpr RI it2 = RI(p+2);
- static_assert(*it1 == p[0], "");
- static_assert(*it2 == p[1], "");
- }
-#endif
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/decrement-assign.pass.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/decrement-assign.pass.cpp
deleted file mode 100644
index 48be8a7399e427..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/decrement-assign.pass.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// requires RandomAccessIterator<Iter>
-// __unconstrained_reverse_iterator& operator-=(
diff erence_type n); // constexpr in C++17
-
-#include <iterator>
-#include <cassert>
-
-#include "test_macros.h"
-#include "test_iterators.h"
-
-template <class It>
-TEST_CONSTEXPR_CXX17 void test(It i, typename std::iterator_traits<It>::
diff erence_type n, It x) {
- std::__unconstrained_reverse_iterator<It> r(i);
- std::__unconstrained_reverse_iterator<It>& rr = r -= n;
- assert(r.base() == x);
- assert(&rr == &r);
-}
-
-TEST_CONSTEXPR_CXX17 bool tests() {
- const char* s = "1234567890";
- test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s+10));
- test(s+5, 5, s+10);
- return true;
-}
-
-int main(int, char**) {
- tests();
-#if TEST_STD_VER > 14
- static_assert(tests(), "");
-#endif
- return 0;
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/increment-assign.pass.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/increment-assign.pass.cpp
deleted file mode 100644
index 115d95e1485cdc..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/increment-assign.pass.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// requires RandomAccessIterator<Iter>
-// __unconstrained_reverse_iterator& operator+=(
diff erence_type n); // constexpr in C++17
-
-#include <iterator>
-#include <cassert>
-
-#include "test_macros.h"
-#include "test_iterators.h"
-
-template <class It>
-TEST_CONSTEXPR_CXX17 void test(It i, typename std::iterator_traits<It>::
diff erence_type n, It x) {
- std::__unconstrained_reverse_iterator<It> r(i);
- std::__unconstrained_reverse_iterator<It>& rr = r += n;
- assert(r.base() == x);
- assert(&rr == &r);
-}
-
-TEST_CONSTEXPR_CXX17 bool tests() {
- char const* s = "1234567890";
- test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s));
- test(s+5, 5, s);
- return true;
-}
-
-int main(int, char**) {
- tests();
-#if TEST_STD_VER > 14
- static_assert(tests(), "");
-#endif
- return 0;
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/minus.pass.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/minus.pass.cpp
deleted file mode 100644
index c3a4d1fd9e36fb..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/minus.pass.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// requires RandomAccessIterator<Iter>
-// __unconstrained_reverse_iterator operator-(
diff erence_type n) const; // constexpr in C++17
-
-#include <iterator>
-#include <cassert>
-
-#include "test_macros.h"
-#include "test_iterators.h"
-
-template <class It>
-TEST_CONSTEXPR_CXX17 void test(It i, typename std::iterator_traits<It>::
diff erence_type n, It x) {
- const std::__unconstrained_reverse_iterator<It> r(i);
- std::__unconstrained_reverse_iterator<It> rr = r - n;
- assert(rr.base() == x);
-}
-
-TEST_CONSTEXPR_CXX17 bool tests() {
- const char* s = "1234567890";
- test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s+10));
- test(s+5, 5, s+10);
- return true;
-}
-
-int main(int, char**) {
- tests();
-#if TEST_STD_VER > 14
- static_assert(tests(), "");
-#endif
- return 0;
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/plus.pass.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/plus.pass.cpp
deleted file mode 100644
index 164c5abe8a3533..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/plus.pass.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// requires RandomAccessIterator<Iter>
-// __unconstrained_reverse_iterator operator+(
diff erence_type n) const; // constexpr in C++17
-
-#include <iterator>
-#include <cassert>
-
-#include "test_macros.h"
-#include "test_iterators.h"
-
-template <class It>
-TEST_CONSTEXPR_CXX17 void test(It i, typename std::iterator_traits<It>::
diff erence_type n, It x) {
- const std::__unconstrained_reverse_iterator<It> r(i);
- std::__unconstrained_reverse_iterator<It> rr = r + n;
- assert(rr.base() == x);
-}
-
-TEST_CONSTEXPR_CXX17 bool tests() {
- const char* s = "1234567890";
- test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s));
- test(s+5, 5, s);
- return true;
-}
-
-int main(int, char**) {
- tests();
-#if TEST_STD_VER > 14
- static_assert(tests(), "");
-#endif
- return 0;
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/postdecrement.pass.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/postdecrement.pass.cpp
deleted file mode 100644
index 3220c1f9b1eb1d..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/postdecrement.pass.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// __unconstrained_reverse_iterator operator--(int); // constexpr in C++17
-
-#include <iterator>
-#include <cassert>
-
-#include "test_macros.h"
-#include "test_iterators.h"
-
-template <class It>
-TEST_CONSTEXPR_CXX17 void test(It i, It x) {
- std::__unconstrained_reverse_iterator<It> r(i);
- std::__unconstrained_reverse_iterator<It> rr = r--;
- assert(r.base() == x);
- assert(rr.base() == i);
-}
-
-TEST_CONSTEXPR_CXX17 bool tests() {
- const char* s = "123";
- test(bidirectional_iterator<const char*>(s+1), bidirectional_iterator<const char*>(s+2));
- test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s+2));
- test(s+1, s+2);
- return true;
-}
-
-int main(int, char**) {
- tests();
-#if TEST_STD_VER > 14
- static_assert(tests(), "");
-#endif
- return 0;
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/postincrement.pass.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/postincrement.pass.cpp
deleted file mode 100644
index 47477fe89545b6..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/postincrement.pass.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// __unconstrained_reverse_iterator operator++(int); // constexpr in C++17
-
-#include <iterator>
-#include <cassert>
-
-#include "test_macros.h"
-#include "test_iterators.h"
-
-template <class It>
-TEST_CONSTEXPR_CXX17 void test(It i, It x) {
- std::__unconstrained_reverse_iterator<It> r(i);
- std::__unconstrained_reverse_iterator<It> rr = r++;
- assert(r.base() == x);
- assert(rr.base() == i);
-}
-
-TEST_CONSTEXPR_CXX17 bool tests() {
- const char* s = "123";
- test(bidirectional_iterator<const char*>(s+1), bidirectional_iterator<const char*>(s));
- test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s));
- test(s+1, s);
- return true;
-}
-
-int main(int, char**) {
- tests();
-#if TEST_STD_VER > 14
- static_assert(tests(), "");
-#endif
- return 0;
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/predecrement.pass.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/predecrement.pass.cpp
deleted file mode 100644
index 6ad41aeaf17a28..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/predecrement.pass.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// __unconstrained_reverse_iterator& operator--(); // constexpr in C++17
-
-#include <iterator>
-#include <cassert>
-
-#include "test_macros.h"
-#include "test_iterators.h"
-
-template <class It>
-TEST_CONSTEXPR_CXX17 void test(It i, It x) {
- std::__unconstrained_reverse_iterator<It> r(i);
- std::__unconstrained_reverse_iterator<It>& rr = --r;
- assert(r.base() == x);
- assert(&rr == &r);
-}
-
-TEST_CONSTEXPR_CXX17 bool tests() {
- const char* s = "123";
- test(bidirectional_iterator<const char*>(s+1), bidirectional_iterator<const char*>(s+2));
- test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s+2));
- test(s+1, s+2);
- return true;
-}
-
-int main(int, char**) {
- tests();
-#if TEST_STD_VER > 14
- static_assert(tests(), "");
-#endif
- return 0;
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/preincrement.pass.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/preincrement.pass.cpp
deleted file mode 100644
index 9c7e5b41738e9b..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nav/preincrement.pass.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// __unconstrained_reverse_iterator& operator++(); // constexpr in C++17
-
-#include <iterator>
-#include <cassert>
-
-#include "test_macros.h"
-#include "test_iterators.h"
-
-template <class It>
-TEST_CONSTEXPR_CXX17 void test(It i, It x) {
- std::__unconstrained_reverse_iterator<It> r(i);
- std::__unconstrained_reverse_iterator<It>& rr = ++r;
- assert(r.base() == x);
- assert(&rr == &r);
-}
-
-TEST_CONSTEXPR_CXX17 bool tests() {
- const char* s = "123";
- test(bidirectional_iterator<const char*>(s+1), bidirectional_iterator<const char*>(s));
- test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s));
- test(s+1, s);
- return true;
-}
-
-int main(int, char**) {
- tests();
-#if TEST_STD_VER > 14
- static_assert(tests(), "");
-#endif
- return 0;
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nonmember/minus.pass.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nonmember/minus.pass.cpp
deleted file mode 100644
index 632e2655dea07f..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/reverse.iter.nonmember/minus.pass.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// template <RandomAccessIterator Iter1, RandomAccessIterator Iter2>
-// requires HasMinus<Iter2, Iter1>
-// auto operator-(const __unconstrained_reverse_iterator<Iter1>& x, const __unconstrained_reverse_iterator<Iter2>& y) // constexpr in C++17
-// -> decltype(y.base() - x.base());
-
-#include <iterator>
-#include <cstddef>
-#include <cassert>
-#include <type_traits>
-
-#include "test_macros.h"
-#include "test_iterators.h"
-
-template <class, class, class = void> struct HasMinus : std::false_type {};
-template <class R1, class R2> struct HasMinus<R1, R2, decltype((R1() - R2(), void()))> : std::true_type {};
-
-template <class It1, class It2>
-TEST_CONSTEXPR_CXX17 void test(It1 l, It2 r, std::ptr
diff _t x) {
- const std::__unconstrained_reverse_iterator<It1> r1(l);
- const std::__unconstrained_reverse_iterator<It2> r2(r);
- assert((r1 - r2) == x);
-}
-
-TEST_CONSTEXPR_CXX17 bool tests() {
- char s[3] = {0};
-
- // Test same base iterator type
- test(s, s, 0);
- test(s, s+1, 1);
- test(s+1, s, -1);
-
- // Test non-subtractable base iterator types
- static_assert( HasMinus<std::__unconstrained_reverse_iterator<int*>, std::__unconstrained_reverse_iterator<int*> >::value, "");
-#if TEST_STD_VER >= 11
- static_assert(!HasMinus<std::__unconstrained_reverse_iterator<int*>, std::__unconstrained_reverse_iterator<char*> >::value, "");
-#endif
-
- return true;
-}
-
-int main(int, char**) {
- tests();
-#if TEST_STD_VER > 14
- static_assert(tests(), "");
-#endif
- return 0;
-}
diff --git a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/types.compile.pass.cpp b/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/types.compile.pass.cpp
deleted file mode 100644
index f8ffef364f37a5..00000000000000
--- a/libcxx/test/libcxx/iterators/predef.iterators/__unconstrained_reverse_iterator/types.compile.pass.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <iterator>
-
-// __unconstrained_reverse_iterator
-
-// Test nested types and data member:
-
-// template <BidirectionalIterator Iter>
-// class __unconstrained_reverse_iterator {
-// protected:
-// Iter current;
-// public:
-// iterator<typename iterator_traits<Iterator>::iterator_category,
-// typename iterator_traits<Iterator>::value_type,
-// typename iterator_traits<Iterator>::
diff erence_type,
-// typename iterator_traits<Iterator>::pointer,
-// typename iterator_traits<Iterator>::reference> {
-// };
-
-#include <iterator>
-#include <type_traits>
-
-#include "test_macros.h"
-#include "test_iterators.h"
-
-template <class It>
-void test() {
- typedef std::__unconstrained_reverse_iterator<It> R;
- typedef std::iterator_traits<It> T;
- static_assert((std::is_same<typename R::iterator_type, It>::value), "");
- static_assert((std::is_same<typename R::value_type, typename T::value_type>::value), "");
- static_assert((std::is_same<typename R::
diff erence_type, typename T::
diff erence_type>::value), "");
- static_assert((std::is_same<typename R::reference, typename T::reference>::value), "");
- static_assert((std::is_same<typename R::pointer, typename std::iterator_traits<It>::pointer>::value), "");
-
-#if TEST_STD_VER <= 14
- typedef std::iterator<typename T::iterator_category, typename T::value_type> iterator_base;
- static_assert((std::is_base_of<iterator_base, R>::value), "");
-#endif
-#if TEST_STD_VER > 17
- if constexpr (std::is_same_v<typename T::iterator_category, std::contiguous_iterator_tag>) {
- static_assert((std::is_same<typename R::iterator_category, std::random_access_iterator_tag>::value), "");
- } else {
- static_assert((std::is_same<typename R::iterator_category, typename T::iterator_category>::value), "");
- }
-#else
- static_assert((std::is_same<typename R::iterator_category, typename T::iterator_category>::value), "");
-#endif
-}
-
-#if TEST_STD_VER > 17
-
-struct FooIter {
- using iterator_category = std::bidirectional_iterator_tag;
- using value_type = void*;
- using
diff erence_type = void*;
- using pointer = void*;
- using reference = int&;
- int& operator*() const;
-};
-template <>
-struct std::indirectly_readable_traits<FooIter> {
- using value_type = int;
-};
-template <>
-struct std::incrementable_traits<FooIter> {
- using
diff erence_type = char;
-};
-
-// Not using `FooIter::value_type`.
-static_assert(std::is_same_v<typename std::__unconstrained_reverse_iterator<FooIter>::value_type, int>);
-// Not using `FooIter::
diff erence_type`.
-static_assert(std::is_same_v<typename std::__unconstrained_reverse_iterator<FooIter>::
diff erence_type, char>);
-
-#endif
-
-struct BarIter {
- bool& operator*() const;
-};
-template <>
-struct std::iterator_traits<BarIter> {
- using
diff erence_type = char;
- using value_type = char;
- using pointer = char*;
- using reference = char&;
- using iterator_category = std::bidirectional_iterator_tag;
-};
-
-#if TEST_STD_VER > 17
- static_assert(std::is_same_v<typename std::__unconstrained_reverse_iterator<BarIter>::reference, bool&>);
-#else
- static_assert(std::is_same<typename std::__unconstrained_reverse_iterator<BarIter>::reference, char&>::value, "");
-#endif
-
-void test_all() {
- test<bidirectional_iterator<char*> >();
- test<random_access_iterator<char*> >();
- test<char*>();
-}
More information about the libcxx-commits
mailing list