| 1 |
// { dg-do compile { target c++20 } } |
| 2 |
|
| 3 |
#include <atomic> |
| 4 |
|
| 5 |
template<class T> concept has_and = requires (T& a) { a &= false; }; |
| 6 |
template<class T> concept has_or = requires (T& a) { a |= false; }; |
| 7 |
template<class T> concept has_xor = requires (T& a) { a ^= false; }; |
| 8 |
template<class T> concept has_fetch_add = requires (T& a) { a.fetch_add(true); }; |
| 9 |
template<class T> concept has_fetch_sub = requires (T& a) { a.fetch_sub(true); }; |
| 10 |
|
| 11 |
static_assert( not has_and<std::atomic_ref<bool>> ); |
| 12 |
static_assert( not has_or<std::atomic_ref<bool>> ); |
| 13 |
static_assert( not has_xor<std::atomic_ref<bool>> ); |
| 14 |
static_assert( not has_fetch_add<std::atomic_ref<bool>> ); |
| 15 |
static_assert( not has_fetch_sub<std::atomic_ref<bool>> ); |