From 3695367ec94f55c5688a871886be9a7f9800beca Mon Sep 17 00:00:00 2001 From: Damien L-G Date: Thu, 16 Jan 2025 16:39:58 -0500 Subject: [PATCH 01/11] Apply clang-format --- libcxx/test/std/atomics/types.pass.cpp | 200 ++++++++++++------------- 1 file changed, 96 insertions(+), 104 deletions(-) diff --git a/libcxx/test/std/atomics/types.pass.cpp b/libcxx/test/std/atomics/types.pass.cpp index 33512c037804f..e07a5bf5fe17b 100644 --- a/libcxx/test/std/atomics/types.pass.cpp +++ b/libcxx/test/std/atomics/types.pass.cpp @@ -30,162 +30,154 @@ #endif template -struct test_atomic -{ - test_atomic() - { - A a; (void)a; +struct test_atomic { + test_atomic() { + A a; + (void)a; #if TEST_STD_VER >= 17 static_assert((std::is_same_v), ""); #endif - } + } }; template -struct test_atomic -{ - test_atomic() - { - A a; (void)a; +struct test_atomic { + test_atomic() { + A a; + (void)a; #if TEST_STD_VER >= 17 static_assert((std::is_same_v), ""); static_assert((std::is_same_v), ""); #endif - } + } }; template -struct test_atomic -{ - test_atomic() - { - A a; (void)a; +struct test_atomic { + test_atomic() { + A a; + (void)a; #if TEST_STD_VER >= 17 static_assert((std::is_same_v), ""); static_assert((std::is_same_v), ""); #endif - } + } }; template -void -test() -{ - using A = std::atomic; +void test() { + using A = std::atomic; #if TEST_STD_VER >= 17 - static_assert((std::is_same_v), ""); + static_assert((std::is_same_v), ""); #endif - test_atomic::value && !std::is_same::value>(); + test_atomic::value && !std::is_same::value>(); } struct TriviallyCopyable { - int i_; + int i_; }; -struct WeirdTriviallyCopyable -{ - char i, j, k; /* the 3 chars of doom */ +struct WeirdTriviallyCopyable { + char i, j, k; /* the 3 chars of doom */ }; -struct PaddedTriviallyCopyable -{ - char i; int j; /* probably lock-free? */ +struct PaddedTriviallyCopyable { + char i; + int j; /* probably lock-free? */ }; -struct LargeTriviallyCopyable -{ - int i, j[127]; /* decidedly not lock-free */ +struct LargeTriviallyCopyable { + int i, j[127]; /* decidedly not lock-free */ }; -int main(int, char**) -{ - test (); - test (); - test (); - test (); - test (); - test (); - test (); - test (); - test (); - test (); - test (); - test (); +int main(int, char**) { + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); #if TEST_STD_VER > 17 && defined(__cpp_char8_t) - test (); + test(); #endif - test (); - test (); + test(); + test(); #ifndef TEST_HAS_NO_WIDE_CHARACTERS - test (); + test(); #endif - test (); - test (); - test (); - test (); - test (); - test (); - test (); - test (); - - test (); - test (); - test (); - test (); - test (); - test (); - test (); - test (); - - test< std::int8_t> (); - test (); - test< std::int16_t> (); - test (); - test< std::int32_t> (); - test (); - test< std::int64_t> (); - test (); - - test (); - test (); - test (); - test (); - test (); - test (); - - test (); - test (); - - test(); - test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + + test< std::int8_t>(); + test(); + test< std::int16_t>(); + test(); + test< std::int32_t>(); + test(); + test< std::int64_t>(); + test(); + + test(); + test(); + test(); + test(); + test(); + test(); + + test(); + test(); + + test(); + test(); #ifndef __APPLE__ // Apple doesn't ship libatomic - /* + /* These aren't going to be lock-free, so some libatomic.a is necessary. */ - test(); - test(); + test(); + test(); #endif #ifndef TEST_HAS_NO_THREADS - test(); + test(); #endif - test(); - test(); + test(); + test(); #if TEST_STD_VER >= 20 - test(); - static_assert(std::is_signed_v); - static_assert(std::is_integral_v); + test(); + static_assert(std::is_signed_v); + static_assert(std::is_integral_v); - test(); - static_assert(std::is_unsigned_v); - static_assert(std::is_integral_v); + test(); + static_assert(std::is_unsigned_v); + static_assert(std::is_integral_v); /* test>(); */ #endif - return 0; + return 0; } From 857e15f045a6f146e42e40e5bbd887d06e34a22d Mon Sep 17 00:00:00 2001 From: Damien L-G Date: Thu, 16 Jan 2025 15:12:58 -0500 Subject: [PATCH 02/11] Fix tests for std::atomic member types --- libcxx/test/std/atomics/types.pass.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/libcxx/test/std/atomics/types.pass.cpp b/libcxx/test/std/atomics/types.pass.cpp index e07a5bf5fe17b..dd8f770ac4543 100644 --- a/libcxx/test/std/atomics/types.pass.cpp +++ b/libcxx/test/std/atomics/types.pass.cpp @@ -29,19 +29,29 @@ # include #endif -template +// detect existence of the difference_type member type +template +using myvoid_t = void; +template +struct has_difference_type : std::false_type {}; +template +struct has_difference_type > : std::true_type {}; + +template struct test_atomic { test_atomic() { + static_assert(!IntegralOrFloating || !Pointer, ""); A a; (void)a; #if TEST_STD_VER >= 17 static_assert((std::is_same_v), ""); + static_assert(!has_difference_type::value, ""); #endif } }; template -struct test_atomic { +struct test_atomic { test_atomic() { A a; (void)a; @@ -53,7 +63,7 @@ struct test_atomic { }; template -struct test_atomic { +struct test_atomic { test_atomic() { A a; (void)a; @@ -70,7 +80,10 @@ void test() { #if TEST_STD_VER >= 17 static_assert((std::is_same_v), ""); #endif - test_atomic::value && !std::is_same::value>(); + constexpr bool IntegralOrFloating = + (std::is_integral::value && !std::is_same::value) || std::is_floating_point::value; + constexpr bool Pointer = std::is_pointer::value; + test_atomic(); } struct TriviallyCopyable { @@ -149,6 +162,11 @@ int main(int, char**) { test(); test(); + test(); + test(); + test(); + test(); + test(); test(); #ifndef __APPLE__ // Apple doesn't ship libatomic From c1ea96634d166b13d7ac6ecc4ec68a02d304be59 Mon Sep 17 00:00:00 2001 From: Damien L-G Date: Thu, 16 Jan 2025 15:13:11 -0500 Subject: [PATCH 03/11] Fix std::atomic primary template should not have difference_type --- libcxx/include/__atomic/atomic.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libcxx/include/__atomic/atomic.h b/libcxx/include/__atomic/atomic.h index 975a479e20400..1ed206ab2ff19 100644 --- a/libcxx/include/__atomic/atomic.h +++ b/libcxx/include/__atomic/atomic.h @@ -40,6 +40,8 @@ struct __atomic_base // false { mutable __cxx_atomic_impl<_Tp> __a_; + using value_type = _Tp; + #if _LIBCPP_STD_VER >= 17 static constexpr bool is_always_lock_free = __libcpp_is_always_lock_free<__cxx_atomic_impl<_Tp> >::__value; #endif @@ -145,6 +147,8 @@ template struct __atomic_base<_Tp, true> : public __atomic_base<_Tp, false> { using __base _LIBCPP_NODEBUG = __atomic_base<_Tp, false>; + using difference_type = __base::value_type; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __atomic_base() _NOEXCEPT = default; _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __base(__d) {} @@ -229,8 +233,6 @@ struct __atomic_waitable_traits<__atomic_base<_Tp, _IsIntegral> > { template struct atomic : public __atomic_base<_Tp> { using __base _LIBCPP_NODEBUG = __atomic_base<_Tp>; - using value_type = _Tp; - using difference_type = value_type; #if _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI atomic() = default; @@ -258,8 +260,8 @@ struct atomic : public __atomic_base<_Tp> { template struct atomic<_Tp*> : public __atomic_base<_Tp*> { using __base _LIBCPP_NODEBUG = __atomic_base<_Tp*>; - using value_type = _Tp*; - using difference_type = ptrdiff_t; + + using difference_type = ptrdiff_t; _LIBCPP_HIDE_FROM_ABI atomic() _NOEXCEPT = default; From af4d5f53a535406ec9842392c3c4ab9e596e2936 Mon Sep 17 00:00:00 2001 From: Damien L-G Date: Thu, 16 Jan 2025 16:35:40 -0500 Subject: [PATCH 04/11] Update expected error for atomic_fetch_{add,sub}[_explicit] with pointers to member function --- .../atomics.types.operations.req/atomic_fetch_add.verify.cpp | 4 ++-- .../atomic_fetch_add_explicit.verify.cpp | 4 ++-- .../atomics.types.operations.req/atomic_fetch_sub.verify.cpp | 4 ++-- .../atomic_fetch_sub_explicit.verify.cpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.verify.cpp b/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.verify.cpp index fbe7dbbd6d9f0..f114efe4e64da 100644 --- a/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.verify.cpp +++ b/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.verify.cpp @@ -63,12 +63,12 @@ struct S { void member_function_pointer() { { volatile std::atomic fun; - // expected-error@*:* {{no member named 'fetch_add' in}} + // expected-error@*:* {{no matching function for call to 'atomic_fetch_add'}} std::atomic_fetch_add(&fun, 0); } { std::atomic fun; - // expected-error@*:* {{no member named 'fetch_add' in}} + // expected-error@*:* {{no matching function for call to 'atomic_fetch_add'}} std::atomic_fetch_add(&fun, 0); } } diff --git a/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.verify.cpp b/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.verify.cpp index 176a38c7c0f7f..04e9c458321df 100644 --- a/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.verify.cpp +++ b/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.verify.cpp @@ -66,12 +66,12 @@ struct S { void member_function_pointer() { { volatile std::atomic fun; - // expected-error@*:* {{no member named 'fetch_add' in}} + // expected-error@*:* {{no matching function for call to 'atomic_fetch_add_explicit'}} std::atomic_fetch_add_explicit(&fun, 0, std::memory_order_relaxed); } { std::atomic fun; - // expected-error@*:* {{no member named 'fetch_add' in}} + // expected-error@*:* {{no matching function for call to 'atomic_fetch_add_explicit'}} std::atomic_fetch_add_explicit(&fun, 0, std::memory_order_relaxed); } } diff --git a/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.verify.cpp b/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.verify.cpp index 6f3039dab6697..dd95c23273733 100644 --- a/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.verify.cpp +++ b/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.verify.cpp @@ -63,12 +63,12 @@ struct S { void member_function_pointer() { { volatile std::atomic fun; - // expected-error@*:* {{no member named 'fetch_sub' in}} + // expected-error@*:* {{no matching function for call to 'atomic_fetch_sub'}} std::atomic_fetch_sub(&fun, 0); } { std::atomic fun; - // expected-error@*:* {{no member named 'fetch_sub' in}} + // expected-error@*:* {{no matching function for call to 'atomic_fetch_sub'}} std::atomic_fetch_sub(&fun, 0); } } diff --git a/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.verify.cpp b/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.verify.cpp index 1b3c58fa87551..b4d4f0a1fc70d 100644 --- a/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.verify.cpp +++ b/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.verify.cpp @@ -66,12 +66,12 @@ struct S { void member_function_pointer() { { volatile std::atomic fun; - // expected-error@*:* {{no member named 'fetch_sub' in}} + // expected-error@*:* {{no matching function for call to 'atomic_fetch_sub_explicit'}} std::atomic_fetch_sub_explicit(&fun, 0, std::memory_order_relaxed); } { std::atomic fun; - // expected-error@*:* {{no member named 'fetch_sub' in}} + // expected-error@*:* {{no matching function for call to 'atomic_fetch_sub_explicit'}} std::atomic_fetch_sub_explicit(&fun, 0, std::memory_order_relaxed); } } From 95a84d452dd29ea47ae44b09e1b5abe31d550e82 Mon Sep 17 00:00:00 2001 From: Damien L-G Date: Thu, 16 Jan 2025 16:47:05 -0500 Subject: [PATCH 05/11] Add test with function pointer --- libcxx/test/std/atomics/types.pass.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libcxx/test/std/atomics/types.pass.cpp b/libcxx/test/std/atomics/types.pass.cpp index dd8f770ac4543..ef01e792cf007 100644 --- a/libcxx/test/std/atomics/types.pass.cpp +++ b/libcxx/test/std/atomics/types.pass.cpp @@ -162,6 +162,7 @@ int main(int, char**) { test(); test(); + test(); test(); test(); test(); From 145d45ac5e8c53396bce4669cb75cdbcc488ade8 Mon Sep 17 00:00:00 2001 From: Damien L-G Date: Fri, 17 Jan 2025 06:35:38 -0500 Subject: [PATCH 06/11] Fixup for cxx03 Work around `error: unknown type name 'constexpr'`. Not sure that is the right approach since `` is C++11... --- libcxx/test/std/atomics/types.pass.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libcxx/test/std/atomics/types.pass.cpp b/libcxx/test/std/atomics/types.pass.cpp index ef01e792cf007..9a3369b2a27f9 100644 --- a/libcxx/test/std/atomics/types.pass.cpp +++ b/libcxx/test/std/atomics/types.pass.cpp @@ -80,9 +80,11 @@ void test() { #if TEST_STD_VER >= 17 static_assert((std::is_same_v), ""); #endif - constexpr bool IntegralOrFloating = - (std::is_integral::value && !std::is_same::value) || std::is_floating_point::value; - constexpr bool Pointer = std::is_pointer::value; + enum { + IntegralOrFloating = + (std::is_integral::value && !std::is_same::value) || std::is_floating_point::value + }; + enum { Pointer = std::is_pointer::value }; test_atomic(); } From 163a79a14538fe7102efab6ef10dcb76a0054445 Mon Sep 17 00:00:00 2001 From: Damien L-G Date: Tue, 21 Jan 2025 09:44:08 +0900 Subject: [PATCH 07/11] Apply suggested changes from review --- libcxx/test/std/atomics/types.pass.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/libcxx/test/std/atomics/types.pass.cpp b/libcxx/test/std/atomics/types.pass.cpp index 9a3369b2a27f9..435311db6a86e 100644 --- a/libcxx/test/std/atomics/types.pass.cpp +++ b/libcxx/test/std/atomics/types.pass.cpp @@ -37,10 +37,14 @@ struct has_difference_type : std::false_type {}; template struct has_difference_type > : std::true_type {}; -template +template ::value && !std::is_same::value) || std::is_floating_point::value, + bool Pointer = std::is_pointer::value> struct test_atomic { test_atomic() { - static_assert(!IntegralOrFloating || !Pointer, ""); + static_assert(!IntegralOrFloating && !Pointer, ""); + using A = std::atomic; A a; (void)a; #if TEST_STD_VER >= 17 @@ -50,9 +54,10 @@ struct test_atomic { } }; -template -struct test_atomic { +template +struct test_atomic { test_atomic() { + using A = std::atomic; A a; (void)a; #if TEST_STD_VER >= 17 @@ -62,9 +67,10 @@ struct test_atomic { } }; -template -struct test_atomic { +template +struct test_atomic { test_atomic() { + using A = std::atomic; A a; (void)a; #if TEST_STD_VER >= 17 @@ -80,12 +86,7 @@ void test() { #if TEST_STD_VER >= 17 static_assert((std::is_same_v), ""); #endif - enum { - IntegralOrFloating = - (std::is_integral::value && !std::is_same::value) || std::is_floating_point::value - }; - enum { Pointer = std::is_pointer::value }; - test_atomic(); + test_atomic(); } struct TriviallyCopyable { From 64257b49a0de328ddf6f7c3a9eecd78f87c3ec1b Mon Sep 17 00:00:00 2001 From: Damien L-G Date: Tue, 21 Jan 2025 09:49:22 +0900 Subject: [PATCH 08/11] Add XFAIL directive for the frozen cxx03 tests per review --- .../atomics.types.operations.req/atomic_fetch_add.verify.cpp | 2 ++ .../atomic_fetch_add_explicit.verify.cpp | 2 ++ .../atomics.types.operations.req/atomic_fetch_sub.verify.cpp | 2 ++ .../atomic_fetch_sub_explicit.verify.cpp | 2 ++ 4 files changed, 8 insertions(+) diff --git a/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.verify.cpp b/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.verify.cpp index f114efe4e64da..320ef57dcb6f9 100644 --- a/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.verify.cpp +++ b/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.verify.cpp @@ -6,6 +6,8 @@ // //===----------------------------------------------------------------------===// +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + // // template diff --git a/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.verify.cpp b/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.verify.cpp index 04e9c458321df..bdd8089feb281 100644 --- a/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.verify.cpp +++ b/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.verify.cpp @@ -6,6 +6,8 @@ // //===----------------------------------------------------------------------===// +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + // // template diff --git a/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.verify.cpp b/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.verify.cpp index dd95c23273733..2c9f89891d5be 100644 --- a/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.verify.cpp +++ b/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.verify.cpp @@ -6,6 +6,8 @@ // //===----------------------------------------------------------------------===// +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + // // template diff --git a/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.verify.cpp b/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.verify.cpp index b4d4f0a1fc70d..88c42750b608a 100644 --- a/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.verify.cpp +++ b/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.verify.cpp @@ -6,6 +6,8 @@ // //===----------------------------------------------------------------------===// +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + // // template From f16cd7b62337819b45c42892c00f329642f4ba21 Mon Sep 17 00:00:00 2001 From: Damien L-G Date: Sat, 8 Feb 2025 13:10:30 -0500 Subject: [PATCH 09/11] Fixup missing typename keyword --- libcxx/include/__atomic/atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcxx/include/__atomic/atomic.h b/libcxx/include/__atomic/atomic.h index 1ed206ab2ff19..278d7f2854bae 100644 --- a/libcxx/include/__atomic/atomic.h +++ b/libcxx/include/__atomic/atomic.h @@ -147,7 +147,7 @@ template struct __atomic_base<_Tp, true> : public __atomic_base<_Tp, false> { using __base _LIBCPP_NODEBUG = __atomic_base<_Tp, false>; - using difference_type = __base::value_type; + using difference_type = typename __base::value_type; _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __atomic_base() _NOEXCEPT = default; From bacb6bbfd58eefc06fef65f9b1f9ecdcb31933ca Mon Sep 17 00:00:00 2001 From: Damien L-G Date: Sat, 8 Feb 2025 19:18:09 -0500 Subject: [PATCH 10/11] Fixup std::atomic::difference_type was introduced in C++20 Drop guards for C++ version greater equal 17 to increase coverage. --- libcxx/test/std/atomics/types.pass.cpp | 46 +++++++++++++++----------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/libcxx/test/std/atomics/types.pass.cpp b/libcxx/test/std/atomics/types.pass.cpp index 435311db6a86e..025dae84ee1ec 100644 --- a/libcxx/test/std/atomics/types.pass.cpp +++ b/libcxx/test/std/atomics/types.pass.cpp @@ -38,54 +38,62 @@ template struct has_difference_type > : std::true_type {}; template ::value && !std::is_same::value) || std::is_floating_point::value, - bool Pointer = std::is_pointer::value> + bool Integral = (std::is_integral::value && !std::is_same::value), + bool Floating = std::is_floating_point::value, + bool Pointer = std::is_pointer::value> struct test_atomic { test_atomic() { - static_assert(!IntegralOrFloating && !Pointer, ""); + static_assert(!Integral && !Floating && !Pointer, ""); using A = std::atomic; A a; (void)a; -#if TEST_STD_VER >= 17 - static_assert((std::is_same_v), ""); + static_assert(std::is_same::value, ""); static_assert(!has_difference_type::value, ""); -#endif } }; template -struct test_atomic { +struct test_atomic { test_atomic() { + static_assert(!std::is_same::value, ""); using A = std::atomic; A a; (void)a; -#if TEST_STD_VER >= 17 - static_assert((std::is_same_v), ""); - static_assert((std::is_same_v), ""); -#endif + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); } }; template -struct test_atomic { +struct test_atomic { test_atomic() { using A = std::atomic; A a; (void)a; -#if TEST_STD_VER >= 17 - static_assert((std::is_same_v), ""); - static_assert((std::is_same_v), ""); + static_assert(std::is_same::value, ""); +#if TEST_STD_VER >= 20 + static_assert(std::is_same::value, ""); +#else + static_assert(!has_difference_type::value, ""); #endif } }; +template +struct test_atomic { + test_atomic() { + using A = std::atomic; + A a; + (void)a; + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + } +}; + template void test() { using A = std::atomic; -#if TEST_STD_VER >= 17 - static_assert((std::is_same_v), ""); -#endif + static_assert(std::is_same::value, ""); test_atomic(); } From 0e2b81f5861e828cd37ee7b1dcbfed9aa72cad68 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Thu, 20 Feb 2025 09:33:38 -0500 Subject: [PATCH 11/11] XFAIL test in C++03 frozen --- libcxx/test/std/atomics/types.pass.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libcxx/test/std/atomics/types.pass.cpp b/libcxx/test/std/atomics/types.pass.cpp index 025dae84ee1ec..8737694e2a070 100644 --- a/libcxx/test/std/atomics/types.pass.cpp +++ b/libcxx/test/std/atomics/types.pass.cpp @@ -17,6 +17,9 @@ // typedef T value_type; // }; +// atomic still has a difference_type in the C++03 frozen headers +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include #include