[libcxx-commits] [libcxx] [libc++] Allow internal functions from atomic_sync.h to be used in C++17 (PR #224356)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Mon Sep 21 05:51:49 PDT 2026


================
@@ -42,12 +44,26 @@ struct __atomic_waitable_traits {
   static void __atomic_contention_address(_AtomicWaitable&&) = delete;
 };
 
+#  if _LIBCPP_STD_VER >= 20
 template <class _Tp>
 concept __atomic_waitable = requires(const _Tp __t, memory_order __order) {
   typename __atomic_waitable_traits<__decay_t<_Tp> >::__value_type;
   { __atomic_waitable_traits<__decay_t<_Tp> >::__atomic_load(__t, __order) };
   { __atomic_waitable_traits<__decay_t<_Tp> >::__atomic_contention_address(__t) };
 };
+#  else
+template <class _Tp, class = void>
+struct __atomic_waitable_impl : false_type {};
+template <class _Tp>
+struct __atomic_waitable_impl< _Tp,
+                               __void_t<typename __atomic_waitable_traits<__decay_t<_Tp> >::__value_type,
+                                        decltype(__atomic_waitable_traits<__decay_t<_Tp> >::__atomic_load(
+                                            std::declval<const _Tp&>(), std::declval<memory_order>())),
+                                        decltype(__atomic_waitable_traits<__decay_t<_Tp> >::__atomic_contention_address(
+                                            std::declval<const _Tp&>())) > > : true_type {};
----------------
philnik777 wrote:

Why not specialize `__atomic_waitable` directly?

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


More information about the libcxx-commits mailing list