| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
// Failed access check should be a substitution failure, not an error. |
| 3 |
|
| 4 |
#define SA(X) static_assert((X),#X) |
| 5 |
|
| 6 |
template<bool B> |
| 7 |
struct bool_constant { static constexpr bool value = B; }; |
| 8 |
|
| 9 |
template<typename _Fn, typename... _ArgTypes> |
| 10 |
struct is_invocable |
| 11 |
: public bool_constant<__is_invocable(_Fn, _ArgTypes...)> |
| 12 |
{ }; |
| 13 |
|
| 14 |
#if __cpp_variable_templates |
| 15 |
template<typename _Fn, typename... _ArgTypes> |
| 16 |
constexpr bool is_invocable_v = __is_invocable(_Fn, _ArgTypes...); |
| 17 |
#endif |
| 18 |
|
| 19 |
class Private |
| 20 |
{ |
| 21 |
void operator()() const |
| 22 |
{ |
| 23 |
SA( ! is_invocable<Private>::value ); |
| 24 |
#if __cpp_variable_templates |
| 25 |
SA( ! is_invocable_v<Private> ); |
| 26 |
#endif |
| 27 |
} |
| 28 |
}; |
| 29 |
|
| 30 |
SA( ! is_invocable<Private>::value ); |
| 31 |
#if __cpp_variable_templates |
| 32 |
SA( ! is_invocable_v<Private> ); |
| 33 |
#endif |