Debian Codegraph @

gcc/testsuite/g++.dg/template/builtin-atomic-overloads2.C

raw
1 /* Check that overloaded builtins can be used in templates with SFINAE. */
2 // { dg-do compile { target c++17 } }
3
4 /* Checks performed here:
5 Parameters without a pointer where it should be. */
6 #define SFINAE_TYPE_CHECK(NAME, PARAMS, NONPOINTER_PARAMS) \
7 template <typename T, typename = void> \
8 struct is_##NAME##_available : std::false_type {}; \
9 template <typename T> \
10 struct is_##NAME##_available<T, \
11 std::void_t<decltype(__atomic_##NAME NONPOINTER_PARAMS) >> \
12 : std::true_type {};
13
14 /* Everything fails with pointer to non-pointer mismatch. */
15 #define MAKE_ATOMIC_ASSERT(NAME, TYPE, SUCCESS) \
16 static_assert(is_##NAME##_available<TYPE>::value == false);
17
18 #include "builtin-atomic-overloads.def"