| 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 |
Too many arguments (for any type three arguments should be invalid). */ |
| 6 |
#define SFINAE_TYPE_CHECK(PARAMS, SHORTENED_PARAMS, INVALID_PARAMS) \ |
| 7 |
template <typename T, typename = void> \ |
| 8 |
struct is_available : std::false_type {}; \ |
| 9 |
template <typename T> \ |
| 10 |
struct is_available<T, \ |
| 11 |
std::void_t<decltype(__builtin_speculation_safe_value \ |
| 12 |
(int(), int(), std::declval<T>())) >> \ |
| 13 |
: std::true_type {}; |
| 14 |
|
| 15 |
/* All types should fail with three arguments. */ |
| 16 |
#define MAKE_SPECULATION_ASSERT(TYPE, SUCCESS) \ |
| 17 |
static_assert(is_available<TYPE>::value == false); |
| 18 |
|
| 19 |
#include "builtin-speculation-overloads.def" |
| 20 |
|