[libcxx-commits] [libcxx] [libc++] Harden the algorithms against volatile pointers (PR #222813)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 10 16:55:16 PDT 2026


================
@@ -92,7 +91,9 @@ struct __fn {
   template <__exchangeable _Tp>
   _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Tp& __x, _Tp& __y) const
       noexcept(is_nothrow_move_constructible_v<_Tp> && is_nothrow_move_assignable_v<_Tp>) {
-    __y = std::exchange(__x, std::move(__y));
+    _Tp __tmp(std::move(__x));
----------------
ldionne wrote:

This one is required to avoid tripping up volatile return types warnings.

https://github.com/llvm/llvm-project/pull/222813


More information about the libcxx-commits mailing list