[libcxx-commits] [libcxx] [libc++] cv-qualified types in atomic and atomic_ref (P3323R1) (PR #121414)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jan 31 12:34:41 PST 2025


================
@@ -114,6 +116,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 template <typename _Tp, typename _Base = __cxx_atomic_base_impl<_Tp> >
 struct __cxx_atomic_impl : public _Base {
   static_assert(is_trivially_copyable<_Tp>::value, "std::atomic<T> requires that 'T' be a trivially copyable type");
+  static_assert(is_same<_Tp, typename remove_cv<_Tp>::type>::value,
+                "std::atomic<T> requires that 'T' be a cv-unqualified type");
----------------
ldionne wrote:

```suggestion
  static_assert(!is_const<_Tp>::value && !is_volatile<_Tp>::value,
                "std::atomic<T> requires that 'T' be a cv-unqualified type");
```

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


More information about the libcxx-commits mailing list