| 1 |
/* Check that one can use integral template argument for memory model argument |
| 2 |
* in atomic SFINAE. */ |
| 3 |
// { dg-do compile { target c++17 } } |
| 4 |
|
| 5 |
#include <type_traits> |
| 6 |
|
| 7 |
template <typename T, int I, typename = void> |
| 8 |
struct is_available : std::false_type {}; |
| 9 |
|
| 10 |
template <typename T, int I> |
| 11 |
struct is_available<T, I, |
| 12 |
std::void_t<decltype(__atomic_load (std::declval<T *>(), |
| 13 |
std::declval<T *>(), I)) >> |
| 14 |
: std::true_type {}; |
| 15 |
|
| 16 |
static_assert(is_available<int,1>::value == true); |
| 17 |
static_assert(is_available<int,10>::value == false); |