diff --git a/libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.advance/iterator_count_sentinel.pass.cpp b/libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.advance/iterator_count_sentinel.pass.cpp index 0a2d03287d0a..b8e43728bbfd 100644 --- a/libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.advance/iterator_count_sentinel.pass.cpp +++ b/libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.advance/iterator_count_sentinel.pass.cpp @@ -31,12 +31,12 @@ public: return false; } - constexpr friend std::ptrdiff_t operator-(std::input_or_output_iterator auto const&, + friend constexpr std::ptrdiff_t operator-(std::input_or_output_iterator auto const&, distance_apriori_sentinel const y) { return -y.count_; } - constexpr friend std::ptrdiff_t operator-(distance_apriori_sentinel const x, + friend constexpr std::ptrdiff_t operator-(distance_apriori_sentinel const x, std::input_or_output_iterator auto const&) { return x.count_; } diff --git a/libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.advance/iterator_sentinel.pass.cpp b/libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.advance/iterator_sentinel.pass.cpp index b70ae9975888..3cc7c6761296 100644 --- a/libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.advance/iterator_sentinel.pass.cpp +++ b/libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.advance/iterator_sentinel.pass.cpp @@ -31,12 +31,12 @@ public: return false; } - constexpr friend std::ptrdiff_t operator-(std::input_or_output_iterator auto const&, + friend constexpr std::ptrdiff_t operator-(std::input_or_output_iterator auto const&, distance_apriori_sentinel const y) { return -y.count_; } - constexpr friend std::ptrdiff_t operator-(distance_apriori_sentinel const x, + friend constexpr std::ptrdiff_t operator-(distance_apriori_sentinel const x, std::input_or_output_iterator auto const&) { return x.count_; } diff --git a/libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.next/iterator_sentinel.pass.cpp b/libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.next/iterator_sentinel.pass.cpp index ef28113dbf7e..b6873c83723c 100644 --- a/libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.next/iterator_sentinel.pass.cpp +++ b/libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.next/iterator_sentinel.pass.cpp @@ -32,12 +32,12 @@ public: return false; } - constexpr friend std::ptrdiff_t operator-(std::input_or_output_iterator auto const&, + friend constexpr std::ptrdiff_t operator-(std::input_or_output_iterator auto const&, distance_apriori_sentinel const y) { return -y.count_; } - constexpr friend std::ptrdiff_t operator-(distance_apriori_sentinel const x, + friend constexpr std::ptrdiff_t operator-(distance_apriori_sentinel const x, std::input_or_output_iterator auto const&) { return x.count_; } diff --git a/libcxx/test/std/ranges/range.access/range.prim/data.pass.cpp b/libcxx/test/std/ranges/range.access/range.prim/data.pass.cpp index 042bc4d5e52e..567412a69268 100644 --- a/libcxx/test/std/ranges/range.access/range.prim/data.pass.cpp +++ b/libcxx/test/std/ranges/range.access/range.prim/data.pass.cpp @@ -123,7 +123,7 @@ static_assert(!std::is_invocable_v); struct BeginFriendContiguousIterator { int buff[8]; - constexpr friend ContiguousIter begin(const BeginFriendContiguousIterator &iter) { + friend constexpr ContiguousIter begin(const BeginFriendContiguousIterator &iter) { return ContiguousIter(iter.buff); } }; diff --git a/libcxx/test/std/ranges/range.adaptors/range.all/all.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.all/all.pass.cpp index 46bd92857203..c4adfb318795 100644 --- a/libcxx/test/std/ranges/range.adaptors/range.all/all.pass.cpp +++ b/libcxx/test/std/ranges/range.adaptors/range.all/all.pass.cpp @@ -27,10 +27,10 @@ struct View : std::ranges::view_base { constexpr explicit View(int start) : start_(start) {} View(View&&) noexcept(IsNoexcept) = default; View& operator=(View&&) noexcept(IsNoexcept) = default; - constexpr friend int* begin(View& view) { return globalBuff + view.start_; } - constexpr friend int* begin(View const& view) { return globalBuff + view.start_; } - constexpr friend int* end(View&) { return globalBuff + 8; } - constexpr friend int* end(View const&) { return globalBuff + 8; } + friend constexpr int* begin(View& view) { return globalBuff + view.start_; } + friend constexpr int* begin(View const& view) { return globalBuff + view.start_; } + friend constexpr int* end(View&) { return globalBuff + 8; } + friend constexpr int* end(View const&) { return globalBuff + 8; } }; static_assert(std::ranges::view>); static_assert(std::ranges::view>); @@ -42,10 +42,10 @@ struct CopyableView : std::ranges::view_base { CopyableView(CopyableView const&) noexcept(IsNoexcept) = default; CopyableView& operator=(CopyableView const&) noexcept(IsNoexcept) = default; constexpr explicit CopyableView(int start) noexcept : start_(start) {} - constexpr friend int* begin(CopyableView& view) { return globalBuff + view.start_; } - constexpr friend int* begin(CopyableView const& view) { return globalBuff + view.start_; } - constexpr friend int* end(CopyableView&) { return globalBuff + 8; } - constexpr friend int* end(CopyableView const&) { return globalBuff + 8; } + friend constexpr int* begin(CopyableView& view) { return globalBuff + view.start_; } + friend constexpr int* begin(CopyableView const& view) { return globalBuff + view.start_; } + friend constexpr int* end(CopyableView&) { return globalBuff + 8; } + friend constexpr int* end(CopyableView const&) { return globalBuff + 8; } }; static_assert(std::ranges::view>); static_assert(std::ranges::view>); @@ -53,19 +53,19 @@ static_assert(std::ranges::view>); struct Range { int start_; constexpr explicit Range(int start) noexcept : start_(start) {} - constexpr friend int* begin(Range const& range) { return globalBuff + range.start_; } - constexpr friend int* begin(Range& range) { return globalBuff + range.start_; } - constexpr friend int* end(Range const&) { return globalBuff + 8; } - constexpr friend int* end(Range&) { return globalBuff + 8; } + friend constexpr int* begin(Range const& range) { return globalBuff + range.start_; } + friend constexpr int* begin(Range& range) { return globalBuff + range.start_; } + friend constexpr int* end(Range const&) { return globalBuff + 8; } + friend constexpr int* end(Range&) { return globalBuff + 8; } }; struct BorrowableRange { int start_; constexpr explicit BorrowableRange(int start) noexcept : start_(start) {} - constexpr friend int* begin(BorrowableRange const& range) { return globalBuff + range.start_; } - constexpr friend int* begin(BorrowableRange& range) { return globalBuff + range.start_; } - constexpr friend int* end(BorrowableRange const&) { return globalBuff + 8; } - constexpr friend int* end(BorrowableRange&) { return globalBuff + 8; } + friend constexpr int* begin(BorrowableRange const& range) { return globalBuff + range.start_; } + friend constexpr int* begin(BorrowableRange& range) { return globalBuff + range.start_; } + friend constexpr int* end(BorrowableRange const&) { return globalBuff + 8; } + friend constexpr int* end(BorrowableRange&) { return globalBuff + 8; } }; template<> inline constexpr bool std::ranges::enable_borrowed_range = true; diff --git a/libcxx/test/std/ranges/range.adaptors/range.common.view/base.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.common.view/base.pass.cpp index bf744c01fafc..0f3df9e72e9c 100644 --- a/libcxx/test/std/ranges/range.adaptors/range.common.view/base.pass.cpp +++ b/libcxx/test/std/ranges/range.adaptors/range.common.view/base.pass.cpp @@ -25,12 +25,12 @@ struct ContiguousView : std::ranges::view_base { constexpr ContiguousView(int* ptr) : ptr_(ptr) {} constexpr ContiguousView(ContiguousView&&) = default; constexpr ContiguousView& operator=(ContiguousView&&) = default; - constexpr friend int* begin(ContiguousView& view) { return view.ptr_; } - constexpr friend int* begin(ContiguousView const& view) { return view.ptr_; } - constexpr friend sentinel_wrapper end(ContiguousView& view) { + friend constexpr int* begin(ContiguousView& view) { return view.ptr_; } + friend constexpr int* begin(ContiguousView const& view) { return view.ptr_; } + friend constexpr sentinel_wrapper end(ContiguousView& view) { return sentinel_wrapper{view.ptr_ + 8}; } - constexpr friend sentinel_wrapper end(ContiguousView const& view) { + friend constexpr sentinel_wrapper end(ContiguousView const& view) { return sentinel_wrapper{view.ptr_ + 8}; } }; @@ -38,12 +38,12 @@ struct ContiguousView : std::ranges::view_base { struct CopyableView : std::ranges::view_base { int *ptr_; constexpr CopyableView(int* ptr) : ptr_(ptr) {} - constexpr friend int* begin(CopyableView& view) { return view.ptr_; } - constexpr friend int* begin(CopyableView const& view) { return view.ptr_; } - constexpr friend sentinel_wrapper end(CopyableView& view) { + friend constexpr int* begin(CopyableView& view) { return view.ptr_; } + friend constexpr int* begin(CopyableView const& view) { return view.ptr_; } + friend constexpr sentinel_wrapper end(CopyableView& view) { return sentinel_wrapper{view.ptr_ + 8}; } - constexpr friend sentinel_wrapper end(CopyableView const& view) { + friend constexpr sentinel_wrapper end(CopyableView const& view) { return sentinel_wrapper{view.ptr_ + 8}; } }; diff --git a/libcxx/test/std/ranges/range.adaptors/range.common.view/begin.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.common.view/begin.pass.cpp index 94e9ddfec174..9edd8eb9ff52 100644 --- a/libcxx/test/std/ranges/range.adaptors/range.common.view/begin.pass.cpp +++ b/libcxx/test/std/ranges/range.adaptors/range.common.view/begin.pass.cpp @@ -25,12 +25,12 @@ struct ContiguousView : std::ranges::view_base { constexpr ContiguousView(int* ptr) : ptr_(ptr) {} constexpr ContiguousView(ContiguousView&&) = default; constexpr ContiguousView& operator=(ContiguousView&&) = default; - constexpr friend int* begin(ContiguousView& view) { return view.ptr_; } - constexpr friend int* begin(ContiguousView const& view) { return view.ptr_; } - constexpr friend sentinel_wrapper end(ContiguousView& view) { + friend constexpr int* begin(ContiguousView& view) { return view.ptr_; } + friend constexpr int* begin(ContiguousView const& view) { return view.ptr_; } + friend constexpr sentinel_wrapper end(ContiguousView& view) { return sentinel_wrapper{view.ptr_ + 8}; } - constexpr friend sentinel_wrapper end(ContiguousView const& view) { + friend constexpr sentinel_wrapper end(ContiguousView const& view) { return sentinel_wrapper{view.ptr_ + 8}; } }; @@ -38,12 +38,12 @@ struct ContiguousView : std::ranges::view_base { struct CopyableView : std::ranges::view_base { int *ptr_; constexpr CopyableView(int* ptr) : ptr_(ptr) {} - constexpr friend int* begin(CopyableView& view) { return view.ptr_; } - constexpr friend int* begin(CopyableView const& view) { return view.ptr_; } - constexpr friend sentinel_wrapper end(CopyableView& view) { + friend constexpr int* begin(CopyableView& view) { return view.ptr_; } + friend constexpr int* begin(CopyableView const& view) { return view.ptr_; } + friend constexpr sentinel_wrapper end(CopyableView& view) { return sentinel_wrapper{view.ptr_ + 8}; } - constexpr friend sentinel_wrapper end(CopyableView const& view) { + friend constexpr sentinel_wrapper end(CopyableView const& view) { return sentinel_wrapper{view.ptr_ + 8}; } }; @@ -59,12 +59,12 @@ using ForwardIter = forward_iterator; struct SizedForwardView : std::ranges::view_base { int *ptr_; constexpr SizedForwardView(int* ptr) : ptr_(ptr) {} - constexpr friend ForwardIter begin(SizedForwardView& view) { return ForwardIter(view.ptr_); } - constexpr friend ForwardIter begin(SizedForwardView const& view) { return ForwardIter(view.ptr_); } - constexpr friend sentinel_wrapper end(SizedForwardView& view) { + friend constexpr ForwardIter begin(SizedForwardView& view) { return ForwardIter(view.ptr_); } + friend constexpr ForwardIter begin(SizedForwardView const& view) { return ForwardIter(view.ptr_); } + friend constexpr sentinel_wrapper end(SizedForwardView& view) { return sentinel_wrapper{ForwardIter(view.ptr_ + 8)}; } - constexpr friend sentinel_wrapper end(SizedForwardView const& view) { + friend constexpr sentinel_wrapper end(SizedForwardView const& view) { return sentinel_wrapper{ForwardIter(view.ptr_ + 8)}; } }; @@ -80,12 +80,12 @@ using RandomAccessIter = random_access_iterator; struct SizedRandomAccessView : std::ranges::view_base { int *ptr_; constexpr SizedRandomAccessView(int* ptr) : ptr_(ptr) {} - constexpr friend RandomAccessIter begin(SizedRandomAccessView& view) { return RandomAccessIter(view.ptr_); } - constexpr friend RandomAccessIter begin(SizedRandomAccessView const& view) { return RandomAccessIter(view.ptr_); } - constexpr friend sentinel_wrapper end(SizedRandomAccessView& view) { + friend constexpr RandomAccessIter begin(SizedRandomAccessView& view) { return RandomAccessIter(view.ptr_); } + friend constexpr RandomAccessIter begin(SizedRandomAccessView const& view) { return RandomAccessIter(view.ptr_); } + friend constexpr sentinel_wrapper end(SizedRandomAccessView& view) { return sentinel_wrapper{RandomAccessIter(view.ptr_ + 8)}; } - constexpr friend sentinel_wrapper end(SizedRandomAccessView const& view) { + friend constexpr sentinel_wrapper end(SizedRandomAccessView const& view) { return sentinel_wrapper{RandomAccessIter(view.ptr_ + 8)}; } }; diff --git a/libcxx/test/std/ranges/range.adaptors/range.common.view/ctor.default.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.common.view/ctor.default.pass.cpp index 2ba59cbe358c..2b76a271ffc9 100644 --- a/libcxx/test/std/ranges/range.adaptors/range.common.view/ctor.default.pass.cpp +++ b/libcxx/test/std/ranges/range.adaptors/range.common.view/ctor.default.pass.cpp @@ -25,12 +25,12 @@ struct ContiguousView : std::ranges::view_base { constexpr ContiguousView(int* ptr) : ptr_(ptr) {} constexpr ContiguousView(ContiguousView&&) = default; constexpr ContiguousView& operator=(ContiguousView&&) = default; - constexpr friend int* begin(ContiguousView& view) { return view.ptr_; } - constexpr friend int* begin(ContiguousView const& view) { return view.ptr_; } - constexpr friend sentinel_wrapper end(ContiguousView& view) { + friend constexpr int* begin(ContiguousView& view) { return view.ptr_; } + friend constexpr int* begin(ContiguousView const& view) { return view.ptr_; } + friend constexpr sentinel_wrapper end(ContiguousView& view) { return sentinel_wrapper{view.ptr_ + 8}; } - constexpr friend sentinel_wrapper end(ContiguousView const& view) { + friend constexpr sentinel_wrapper end(ContiguousView const& view) { return sentinel_wrapper{view.ptr_ + 8}; } }; @@ -38,12 +38,12 @@ struct ContiguousView : std::ranges::view_base { struct CopyableView : std::ranges::view_base { int *ptr_; constexpr CopyableView(int* ptr = globalBuffer) : ptr_(ptr) {} - constexpr friend int* begin(CopyableView& view) { return view.ptr_; } - constexpr friend int* begin(CopyableView const& view) { return view.ptr_; } - constexpr friend sentinel_wrapper end(CopyableView& view) { + friend constexpr int* begin(CopyableView& view) { return view.ptr_; } + friend constexpr int* begin(CopyableView const& view) { return view.ptr_; } + friend constexpr sentinel_wrapper end(CopyableView& view) { return sentinel_wrapper{view.ptr_ + 4}; } - constexpr friend sentinel_wrapper end(CopyableView const& view) { + friend constexpr sentinel_wrapper end(CopyableView const& view) { return sentinel_wrapper{view.ptr_ + 4}; } }; diff --git a/libcxx/test/std/ranges/range.adaptors/range.common.view/size.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.common.view/size.pass.cpp index db5873477921..464b9ea14759 100644 --- a/libcxx/test/std/ranges/range.adaptors/range.common.view/size.pass.cpp +++ b/libcxx/test/std/ranges/range.adaptors/range.common.view/size.pass.cpp @@ -22,12 +22,12 @@ struct CopyableView : std::ranges::view_base { int *ptr_; constexpr CopyableView(int* ptr) : ptr_(ptr) {} - constexpr friend int* begin(CopyableView& view) { return view.ptr_; } - constexpr friend int* begin(CopyableView const& view) { return view.ptr_; } - constexpr friend sentinel_wrapper end(CopyableView& view) { + friend constexpr int* begin(CopyableView& view) { return view.ptr_; } + friend constexpr int* begin(CopyableView const& view) { return view.ptr_; } + friend constexpr sentinel_wrapper end(CopyableView& view) { return sentinel_wrapper{view.ptr_ + 8}; } - constexpr friend sentinel_wrapper end(CopyableView const& view) { + friend constexpr sentinel_wrapper end(CopyableView const& view) { return sentinel_wrapper{view.ptr_ + 8}; } }; @@ -36,12 +36,12 @@ using ForwardIter = forward_iterator; struct SizedForwardView : std::ranges::view_base { int *ptr_; constexpr SizedForwardView(int* ptr) : ptr_(ptr) {} - constexpr friend ForwardIter begin(SizedForwardView& view) { return ForwardIter(view.ptr_); } - constexpr friend ForwardIter begin(SizedForwardView const& view) { return ForwardIter(view.ptr_); } - constexpr friend sentinel_wrapper end(SizedForwardView& view) { + friend constexpr ForwardIter begin(SizedForwardView& view) { return ForwardIter(view.ptr_); } + friend constexpr ForwardIter begin(SizedForwardView const& view) { return ForwardIter(view.ptr_); } + friend constexpr sentinel_wrapper end(SizedForwardView& view) { return sentinel_wrapper{ForwardIter(view.ptr_ + 8)}; } - constexpr friend sentinel_wrapper end(SizedForwardView const& view) { + friend constexpr sentinel_wrapper end(SizedForwardView const& view) { return sentinel_wrapper{ForwardIter(view.ptr_ + 8)}; } }; diff --git a/libcxx/test/std/ranges/range.adaptors/range.drop/types.h b/libcxx/test/std/ranges/range.adaptors/range.drop/types.h index 692fdfece277..e861f6f029da 100644 --- a/libcxx/test/std/ranges/range.adaptors/range.drop/types.h +++ b/libcxx/test/std/ranges/range.adaptors/range.drop/types.h @@ -19,10 +19,10 @@ struct ContiguousView : std::ranges::view_base { constexpr ContiguousView(int start = 0) : start_(start) {} constexpr ContiguousView(ContiguousView&&) = default; constexpr ContiguousView& operator=(ContiguousView&&) = default; - constexpr friend int* begin(ContiguousView& view) { return globalBuff + view.start_; } - constexpr friend int* begin(ContiguousView const& view) { return globalBuff + view.start_; } - constexpr friend int* end(ContiguousView&) { return globalBuff + 8; } - constexpr friend int* end(ContiguousView const&) { return globalBuff + 8; } + friend constexpr int* begin(ContiguousView& view) { return globalBuff + view.start_; } + friend constexpr int* begin(ContiguousView const& view) { return globalBuff + view.start_; } + friend constexpr int* end(ContiguousView&) { return globalBuff + 8; } + friend constexpr int* end(ContiguousView const&) { return globalBuff + 8; } }; struct CopyableView : std::ranges::view_base { @@ -30,10 +30,10 @@ struct CopyableView : std::ranges::view_base { constexpr CopyableView(int start = 0) : start_(start) {} constexpr CopyableView(CopyableView const&) = default; constexpr CopyableView& operator=(CopyableView const&) = default; - constexpr friend int* begin(CopyableView& view) { return globalBuff + view.start_; } - constexpr friend int* begin(CopyableView const& view) { return globalBuff + view.start_; } - constexpr friend int* end(CopyableView&) { return globalBuff + 8; } - constexpr friend int* end(CopyableView const&) { return globalBuff + 8; } + friend constexpr int* begin(CopyableView& view) { return globalBuff + view.start_; } + friend constexpr int* begin(CopyableView const& view) { return globalBuff + view.start_; } + friend constexpr int* end(CopyableView&) { return globalBuff + 8; } + friend constexpr int* end(CopyableView const&) { return globalBuff + 8; } }; using ForwardIter = forward_iterator; @@ -41,10 +41,10 @@ struct ForwardView : std::ranges::view_base { constexpr ForwardView() = default; constexpr ForwardView(ForwardView&&) = default; constexpr ForwardView& operator=(ForwardView&&) = default; - constexpr friend ForwardIter begin(ForwardView&) { return ForwardIter(globalBuff); } - constexpr friend ForwardIter begin(ForwardView const&) { return ForwardIter(globalBuff); } - constexpr friend ForwardIter end(ForwardView&) { return ForwardIter(globalBuff + 8); } - constexpr friend ForwardIter end(ForwardView const&) { return ForwardIter(globalBuff + 8); } + friend constexpr ForwardIter begin(ForwardView&) { return ForwardIter(globalBuff); } + friend constexpr ForwardIter begin(ForwardView const&) { return ForwardIter(globalBuff); } + friend constexpr ForwardIter end(ForwardView&) { return ForwardIter(globalBuff + 8); } + friend constexpr ForwardIter end(ForwardView const&) { return ForwardIter(globalBuff + 8); } }; struct ForwardRange { diff --git a/libcxx/test/std/ranges/range.adaptors/range.transform/types.h b/libcxx/test/std/ranges/range.adaptors/range.transform/types.h index 89dd0849582c..1f5fa646c301 100644 --- a/libcxx/test/std/ranges/range.adaptors/range.transform/types.h +++ b/libcxx/test/std/ranges/range.adaptors/range.transform/types.h @@ -16,10 +16,10 @@ struct ContiguousView : std::ranges::view_base { constexpr ContiguousView(int* ptr = globalBuff, int start = 0) : start_(start), ptr_(ptr) {} constexpr ContiguousView(ContiguousView&&) = default; constexpr ContiguousView& operator=(ContiguousView&&) = default; - constexpr friend int* begin(ContiguousView& view) { return view.ptr_ + view.start_; } - constexpr friend int* begin(ContiguousView const& view) { return view.ptr_ + view.start_; } - constexpr friend int* end(ContiguousView& view) { return view.ptr_ + 8; } - constexpr friend int* end(ContiguousView const& view) { return view.ptr_ + 8; } + friend constexpr int* begin(ContiguousView& view) { return view.ptr_ + view.start_; } + friend constexpr int* begin(ContiguousView const& view) { return view.ptr_ + view.start_; } + friend constexpr int* end(ContiguousView& view) { return view.ptr_ + 8; } + friend constexpr int* end(ContiguousView const& view) { return view.ptr_ + 8; } }; struct CopyableView : std::ranges::view_base { @@ -27,10 +27,10 @@ struct CopyableView : std::ranges::view_base { constexpr CopyableView(int start = 0) : start_(start) {} constexpr CopyableView(CopyableView const&) = default; constexpr CopyableView& operator=(CopyableView const&) = default; - constexpr friend int* begin(CopyableView& view) { return globalBuff + view.start_; } - constexpr friend int* begin(CopyableView const& view) { return globalBuff + view.start_; } - constexpr friend int* end(CopyableView&) { return globalBuff + 8; } - constexpr friend int* end(CopyableView const&) { return globalBuff + 8; } + friend constexpr int* begin(CopyableView& view) { return globalBuff + view.start_; } + friend constexpr int* begin(CopyableView const& view) { return globalBuff + view.start_; } + friend constexpr int* end(CopyableView&) { return globalBuff + 8; } + friend constexpr int* end(CopyableView const&) { return globalBuff + 8; } }; using ForwardIter = forward_iterator; @@ -39,10 +39,10 @@ struct ForwardView : std::ranges::view_base { constexpr ForwardView(int* ptr = globalBuff) : ptr_(ptr) {} constexpr ForwardView(ForwardView&&) = default; constexpr ForwardView& operator=(ForwardView&&) = default; - constexpr friend ForwardIter begin(ForwardView& view) { return ForwardIter(view.ptr_); } - constexpr friend ForwardIter begin(ForwardView const& view) { return ForwardIter(view.ptr_); } - constexpr friend ForwardIter end(ForwardView& view) { return ForwardIter(view.ptr_ + 8); } - constexpr friend ForwardIter end(ForwardView const& view) { return ForwardIter(view.ptr_ + 8); } + friend constexpr ForwardIter begin(ForwardView& view) { return ForwardIter(view.ptr_); } + friend constexpr ForwardIter begin(ForwardView const& view) { return ForwardIter(view.ptr_); } + friend constexpr ForwardIter end(ForwardView& view) { return ForwardIter(view.ptr_ + 8); } + friend constexpr ForwardIter end(ForwardView const& view) { return ForwardIter(view.ptr_ + 8); } }; using ForwardRange = test_common_range; diff --git a/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp b/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp index a23b54ebe260..2ab8e7f26139 100644 --- a/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp +++ b/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp @@ -31,7 +31,7 @@ public: constexpr X(int i) : i_(i) {} constexpr X(int i, int j) : i_(i), j_(j) {} - constexpr friend bool operator==(const X& x, const X& y) + friend constexpr bool operator==(const X& x, const X& y) {return x.i_ == y.i_ && x.j_ == y.j_;} }; diff --git a/libcxx/test/support/test_iterators.h b/libcxx/test/support/test_iterators.h index a77c1a103fce..3301264dee34 100644 --- a/libcxx/test/support/test_iterators.h +++ b/libcxx/test/support/test_iterators.h @@ -848,25 +848,25 @@ public: return *this; } - constexpr friend stride_counting_iterator operator+(stride_counting_iterator i, difference_type const n) + friend constexpr stride_counting_iterator operator+(stride_counting_iterator i, difference_type const n) requires std::random_access_iterator { return i += n; } - constexpr friend stride_counting_iterator operator+(difference_type const n, stride_counting_iterator i) + friend constexpr stride_counting_iterator operator+(difference_type const n, stride_counting_iterator i) requires std::random_access_iterator { return i += n; } - constexpr friend stride_counting_iterator operator-(stride_counting_iterator i, difference_type const n) + friend constexpr stride_counting_iterator operator-(stride_counting_iterator i, difference_type const n) requires std::random_access_iterator { return i -= n; } - constexpr friend difference_type operator-(stride_counting_iterator const& x, stride_counting_iterator const& y) + friend constexpr difference_type operator-(stride_counting_iterator const& x, stride_counting_iterator const& y) requires std::sized_sentinel_for { return x.base() - y.base(); @@ -884,25 +884,25 @@ public: return base_ == last; } - constexpr friend bool operator<(stride_counting_iterator const& x, stride_counting_iterator const& y) + friend constexpr bool operator<(stride_counting_iterator const& x, stride_counting_iterator const& y) requires std::random_access_iterator { return x.base_ < y.base_; } - constexpr friend bool operator>(stride_counting_iterator const& x, stride_counting_iterator const& y) + friend constexpr bool operator>(stride_counting_iterator const& x, stride_counting_iterator const& y) requires std::random_access_iterator { return y < x; } - constexpr friend bool operator<=(stride_counting_iterator const& x, stride_counting_iterator const& y) + friend constexpr bool operator<=(stride_counting_iterator const& x, stride_counting_iterator const& y) requires std::random_access_iterator { return !(y < x); } - constexpr friend bool operator>=(stride_counting_iterator const& x, stride_counting_iterator const& y) + friend constexpr bool operator>=(stride_counting_iterator const& x, stride_counting_iterator const& y) requires std::random_access_iterator { return !(x < y); diff --git a/libcxx/test/support/type_classification/swappable.h b/libcxx/test/support/type_classification/swappable.h index f7916e4b0646..ebbac912072b 100644 --- a/libcxx/test/support/type_classification/swappable.h +++ b/libcxx/test/support/type_classification/swappable.h @@ -34,7 +34,7 @@ public: return *this; } - constexpr friend void swap(lvalue_adl_swappable& x, + friend constexpr void swap(lvalue_adl_swappable& x, lvalue_adl_swappable& y) noexcept { std::ranges::swap(x.value_, y.value_); } @@ -70,7 +70,7 @@ public: return *this; } - constexpr friend void swap(lvalue_rvalue_adl_swappable& x, + friend constexpr void swap(lvalue_rvalue_adl_swappable& x, lvalue_rvalue_adl_swappable&& y) noexcept { std::ranges::swap(x.value_, y.value_); } @@ -107,7 +107,7 @@ public: return *this; } - constexpr friend void swap(rvalue_lvalue_adl_swappable&& x, + friend constexpr void swap(rvalue_lvalue_adl_swappable&& x, rvalue_lvalue_adl_swappable& y) noexcept { std::ranges::swap(x.value_, y.value_); } @@ -142,7 +142,7 @@ public: return *this; } - constexpr friend void swap(rvalue_adl_swappable&& x, + friend constexpr void swap(rvalue_adl_swappable&& x, rvalue_adl_swappable&& y) noexcept { std::ranges::swap(x.value_, y.value_); } @@ -179,7 +179,7 @@ public: return *this; } - constexpr friend void swap(non_move_constructible_adl_swappable& x, + friend constexpr void swap(non_move_constructible_adl_swappable& x, non_move_constructible_adl_swappable& y) noexcept { std::ranges::swap(x.value_, y.value_); } @@ -212,7 +212,7 @@ public: constexpr non_move_assignable_adl_swappable& operator=(non_move_assignable_adl_swappable&& other) noexcept = delete; - constexpr friend void swap(non_move_assignable_adl_swappable& x, + friend constexpr void swap(non_move_assignable_adl_swappable& x, non_move_assignable_adl_swappable& y) noexcept { std::ranges::swap(x.value_, y.value_); } @@ -248,7 +248,7 @@ public: return *this; } - constexpr friend void swap(throwable_adl_swappable& X, + friend constexpr void swap(throwable_adl_swappable& X, throwable_adl_swappable& Y) noexcept(false) { std::ranges::swap(X.value_, Y.value_); }