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

Damien L-G via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 20 12:47:09 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, "");
----------------
dalg24 wrote:

No, I meant it, that is `!(IntegralOrFloating && Pointer)`, as a sanity check that (true, true) never happens.
But with your question I see that this is confusing.
Would you like me to drop it?

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


More information about the libcxx-commits mailing list