From f9c8b3d29114a886062d10bb45b854b47052824b Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Mon, 7 Oct 2024 15:36:57 -0700 Subject: [PATCH] Add a check for trivial_relocatability --- libcxx/include/__algorithm/swap_ranges.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libcxx/include/__algorithm/swap_ranges.h b/libcxx/include/__algorithm/swap_ranges.h index e3f62e371da9ea..e94f02b45c725c 100644 --- a/libcxx/include/__algorithm/swap_ranges.h +++ b/libcxx/include/__algorithm/swap_ranges.h @@ -46,7 +46,8 @@ __swap_ranges(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2 using _V2Type = iterator_traits<_ForwardIterator2>::value_type; if constexpr(__libcpp_is_contiguous_iterator<_ForwardIterator1>::value && __libcpp_is_contiguous_iterator<_ForwardIterator2>::value && - is_same_v<_V1Type, _V2Type> && is_replaceable_v<_V1Type>) { + is_same_v<_V1Type, _V2Type> && + is_trivially_relocatable_v<_V1Type> && is_replaceable_v<_V1Type>) { size_t __distance = distance(__first1, __last1); if (__distance == 1) { using std::swap;