(root)/
gcc-13.2.0/
libstdc++-v3/
testsuite/
29_atomics/
atomic/
lock_free_aliases.cc
// { dg-options "-std=gnu++20" }
// { dg-do compile { target c++20 } }

#include <atomic>

#ifndef __cpp_lib_atomic_lock_free_type_aliases
# error "Feature test macro for lock-free type aliases is missing in <atomic>"
#elif __cpp_lib_atomic_lock_free_type_aliases != 201907L
# error "Feature test macro for lock-free type aliases has wrong value in <atomic>"
#endif

template<typename T>
constexpr bool is_atomic_specialization = false;
template<typename T>
constexpr bool is_atomic_specialization<std::atomic<T>> = true;

// The type aliases atomic_signed_lock_free and atomic_unsigned_lock_free
// name specializations of atomic
static_assert( is_atomic_specialization<std::atomic_signed_lock_free> );
static_assert( is_atomic_specialization<std::atomic_unsigned_lock_free> );

#include <type_traits>

// ... whose template arguments are integral types,
static_assert( std::is_integral_v<std::atomic_signed_lock_free::value_type> );
static_assert( std::is_integral_v<std::atomic_unsigned_lock_free::value_type> );

// ... respectively signed and unsigned,
static_assert( std::is_signed_v<std::atomic_signed_lock_free::value_type> );
static_assert( std::is_unsigned_v<std::atomic_unsigned_lock_free::value_type> );

// and whose is_always_lock_free property is true.
static_assert( std::atomic_signed_lock_free::is_always_lock_free );
static_assert( std::atomic_unsigned_lock_free::is_always_lock_free );