diff --git a/libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.random.access/contiguous_iterator.compile.pass.cpp b/libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.random.access/contiguous_iterator.compile.pass.cpp --- a/libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.random.access/contiguous_iterator.compile.pass.cpp +++ b/libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.random.access/contiguous_iterator.compile.pass.cpp @@ -14,6 +14,7 @@ // concept contiguous_iterator; #include +#include #include "test_iterators.h" @@ -42,11 +43,7 @@ reference operator*() const; pointer operator->() const; - friend bool operator==(const self&, const self& y); - friend bool operator< (const self&, const self& y); - friend bool operator<=(const self&, const self& y); - friend bool operator> (const self&, const self& y); - friend bool operator>=(const self&, const self& y); + auto operator<=>(const self&) const = default; self& operator++(); self operator++(int); @@ -68,23 +65,19 @@ static_assert(std::random_access_iterator); static_assert(std::contiguous_iterator); -struct missmatch_value_iter_ref_t { +struct mismatch_value_iter_ref_t { typedef std::contiguous_iterator_tag iterator_category; typedef short value_type; typedef std::ptrdiff_t difference_type; typedef int* pointer; typedef int& reference; - typedef missmatch_value_iter_ref_t self; + typedef mismatch_value_iter_ref_t self; - missmatch_value_iter_ref_t(); + mismatch_value_iter_ref_t(); reference operator*() const; pointer operator->() const; - friend bool operator==(const self&, const self& y); - friend bool operator< (const self&, const self& y); - friend bool operator<=(const self&, const self& y); - friend bool operator> (const self&, const self& y); - friend bool operator>=(const self&, const self& y); + auto operator<=>(const self&) const = default; self& operator++(); self operator++(int); @@ -103,8 +96,8 @@ reference operator[](difference_type n) const; }; -static_assert(std::random_access_iterator); -static_assert(!std::contiguous_iterator); +static_assert(std::random_access_iterator); +static_assert(!std::contiguous_iterator); struct wrong_iter_reference_t { typedef std::contiguous_iterator_tag iterator_category; @@ -118,11 +111,7 @@ reference operator*() const; pointer operator->() const; - friend bool operator==(const self&, const self& y); - friend bool operator< (const self&, const self& y); - friend bool operator<=(const self&, const self& y); - friend bool operator> (const self&, const self& y); - friend bool operator>=(const self&, const self& y); + auto operator<=>(const self&) const = default; self& operator++(); self operator++(int); @@ -156,11 +145,7 @@ reference operator*() const; pointer operator->() const; - friend bool operator==(const self&, const self& y); - friend bool operator< (const self&, const self& y); - friend bool operator<=(const self&, const self& y); - friend bool operator> (const self&, const self& y); - friend bool operator>=(const self&, const self& y); + auto operator<=>(const self&) const = default; self& operator++(); self operator++(int); @@ -195,11 +180,7 @@ reference operator*() const; pointer operator->() const; - friend bool operator==(const self&, const self& y); - friend bool operator< (const self&, const self& y); - friend bool operator<=(const self&, const self& y); - friend bool operator> (const self&, const self& y); - friend bool operator>=(const self&, const self& y); + auto operator<=>(const self&) const = default; self& operator++(); self operator++(int); @@ -240,11 +221,7 @@ reference operator*() const; pointer operator->() const; - friend bool operator==(const self&, const self& y); - friend bool operator< (const self&, const self& y); - friend bool operator<=(const self&, const self& y); - friend bool operator> (const self&, const self& y); - friend bool operator>=(const self&, const self& y); + auto operator<=>(const self&) const = default; self& operator++(); self operator++(int); @@ -254,7 +231,7 @@ self& operator+=(difference_type n); self operator+(difference_type n) const; - friend self operator+(difference_type n, self x); + friend self operator+(difference_type, self) { return self{}; } self& operator-=(difference_type n); self operator-(difference_type n) const; diff --git a/libcxx/test/std/ranges/range.utility/view.interface/view.interface.pass.cpp b/libcxx/test/std/ranges/range.utility/view.interface/view.interface.pass.cpp --- a/libcxx/test/std/ranges/range.utility/view.interface/view.interface.pass.cpp +++ b/libcxx/test/std/ranges/range.utility/view.interface/view.interface.pass.cpp @@ -43,20 +43,16 @@ }; struct NotSizedSentinel { - using I = int*; - using value_type = std::iter_value_t; - using difference_type = std::iter_difference_t; + using value_type = int; + using difference_type = std::ptrdiff_t; using iterator_concept = std::forward_iterator_tag; - NotSizedSentinel() = default; - explicit constexpr NotSizedSentinel(I); - - constexpr int &operator*() const { return *value; }; + explicit NotSizedSentinel() = default; + explicit NotSizedSentinel(int*); + int& operator*() const; NotSizedSentinel& operator++(); NotSizedSentinel operator++(int); bool operator==(NotSizedSentinel const&) const; - - int *value; }; static_assert(std::forward_iterator); @@ -127,13 +123,13 @@ }; struct SentinelType { - int *base; + int *base_; SentinelType() = default; - explicit constexpr SentinelType(int *base) : base(base) {} - friend constexpr ResultType operator==(ForwardIter const& iter, SentinelType const& sent) noexcept { return {iter.base() == sent.base}; } - friend constexpr ResultType operator==(SentinelType const& sent, ForwardIter const& iter) noexcept { return {iter.base() == sent.base}; } - friend constexpr ResultType operator!=(ForwardIter const& iter, SentinelType const& sent) noexcept { return {iter.base() != sent.base}; } - friend constexpr ResultType operator!=(SentinelType const& sent, ForwardIter const& iter) noexcept { return {iter.base() != sent.base}; } + explicit constexpr SentinelType(int *base) : base_(base) {} + friend constexpr ResultType operator==(ForwardIter const& iter, SentinelType const& sent) noexcept { return {iter.base() == sent.base_}; } + friend constexpr ResultType operator==(SentinelType const& sent, ForwardIter const& iter) noexcept { return {iter.base() == sent.base_}; } + friend constexpr ResultType operator!=(ForwardIter const& iter, SentinelType const& sent) noexcept { return {iter.base() != sent.base_}; } + friend constexpr ResultType operator!=(SentinelType const& sent, ForwardIter const& iter) noexcept { return {iter.base() != sent.base_}; } }; int buff[8] = {0, 1, 2, 3, 4, 5, 6, 7}; diff --git a/libcxx/test/std/strings/string.view/string.view.ops/copy.pass.cpp b/libcxx/test/std/strings/string.view/string.view.ops/copy.pass.cpp --- a/libcxx/test/std/strings/string.view/string.view.ops/copy.pass.cpp +++ b/libcxx/test/std/strings/string.view/string.view.ops/copy.pass.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -// XFAIL: gcc-10 +// XFAIL: gcc-10, gcc-11 // GCC's __builtin_strlen isn't constexpr yet // UNSUPPORTED: LIBCXX-DEBUG-FIXME