[libcxx-commits] [libcxx] [libc++] Implement P0493R5: Atomic minimum/maximum (PR #180333)

Connector Switch via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 26 06:59:38 PDT 2026


================
@@ -259,6 +261,77 @@ __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_o
       std::addressof(__a->__a_value), __pattern, static_cast<__memory_order_underlying_t>(__order));
 }
 
+// Clang's __c11_atomic_fetch_max/min builtins do not accept pointer
+// arguments, so dispatch to a CAS loop for pointer types.
+// TODO: Use the builtin for pointer types once Clang accepts them.
+template <class _Tp, __enable_if_t<!is_pointer<_Tp>::value, int> = 0>
----------------
c8ef wrote:

Since `c11.h` seems to be included in most language modes, would it be better to use a more compatible approach, like `enable_if`?

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


More information about the libcxx-commits mailing list