[libcxx-commits] [libcxx] [libcxx] Implementation of P1831R1 (PR #101439)

Josh Karns via libcxx-commits libcxx-commits at lists.llvm.org
Sun Aug 4 15:39:28 PDT 2024


================
@@ -27,6 +27,19 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#if _LIBCPP_STD_VER >= 20
+#  define _LIBCPP_DEPRECATED_NOT_ALWAYS_LOCK_FREE                                                                      \
+    [[deprecated("volatile atomic operations are deprecated when std::atomic<T>::is_always_lock_free is false")]]
+#else
+#  define _LIBCPP_DEPRECATED_NOT_ALWAYS_LOCK_FREE
+#endif
+
+template <class _Tp, bool always_lock_free>
+constexpr bool __deprecated_if_not_awlays_lock_free = true;
+
+template <class _Tp>
+_LIBCPP_DEPRECATED_NOT_ALWAYS_LOCK_FREE constexpr bool __deprecated_if_not_awlays_lock_free<_Tp, false> = true;
+
----------------
jkarns275 wrote:

I share your distaste for this use of static assertions, hopefully the issue with attributes on template specializations is eventually fixed (though I'm not 100% sure if its a bug or a feature).

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


More information about the libcxx-commits mailing list