[libcxx-commits] [libcxx] [libc++] std::atomic primary template should not have a `difference_type` member type (PR #123236)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 20 06:07:02 PST 2025


================
@@ -29,163 +29,176 @@
 #  include <thread>
 #endif
 
-template <class A, bool Integral>
-struct test_atomic
-{
-    test_atomic()
-    {
-        A a; (void)a;
+// detect existence of the difference_type member type
+template <class...>
+using myvoid_t = void;
+template <typename T, typename = void>
+struct has_difference_type : std::false_type {};
+template <typename T>
+struct has_difference_type<T, myvoid_t<typename T::difference_type> > : std::true_type {};
+
+template <class A, bool IntegralOrFloating, bool Pointer>
+struct test_atomic {
+  test_atomic() {
+    static_assert(!IntegralOrFloating || !Pointer, "");
----------------
ldionne wrote:

Don't you mean `static_assert(!IntegralOrFloating && !Pointer, "");`?

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


More information about the libcxx-commits mailing list