| 1 |
/* Check that overloaded builtins can be used in templates with SFINAE. */ |
| 2 |
// { dg-do compile { target c++17 } } |
| 3 |
|
| 4 |
/* builtin-atomic-overloads{1,2,3,4,5}.C are focussed on checking various |
| 5 |
properties of all the different atomic builtins. |
| 6 |
builtin-atomic-overloads6.C is focussed on checking all error conditions in |
| 7 |
the code ignoring which builtin we trigger them with. */ |
| 8 |
|
| 9 |
/* Checks performed here: |
| 10 |
Correctly specified -- as long as the type is something that these builtins |
| 11 |
can work on. */ |
| 12 |
#define SFINAE_TYPE_CHECK(NAME, PARAMS, NONPOINTER_PARAMS) \ |
| 13 |
template <typename T, typename = void> \ |
| 14 |
struct is_##NAME##_available : std::false_type {}; \ |
| 15 |
template <typename T> \ |
| 16 |
struct is_##NAME##_available<T, \ |
| 17 |
std::void_t<decltype(__atomic_##NAME PARAMS) >> \ |
| 18 |
: std::true_type {}; |
| 19 |
|
| 20 |
/* Success according to type argument. */ |
| 21 |
#define MAKE_ATOMIC_ASSERT(NAME, TYPE, SUCCESS) \ |
| 22 |
static_assert(is_##NAME##_available<TYPE>::value == SUCCESS); |
| 23 |
|
| 24 |
#include "builtin-atomic-overloads.def" |