1 | //===----------------------------------------------------------------------===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #include <type_traits> |
10 | |
11 | struct Functor { |
12 | void operator()(); |
13 | }; |
14 | |
15 | int func(); |
16 | |
17 | struct NotFunctor { |
18 | bool compare(); |
19 | }; |
20 | |
21 | struct ArgumentFunctor { |
22 | bool operator()(int, int); |
23 | }; |
24 | |
25 | static_assert(std::__is_callable<Functor>::value, "" ); |
26 | static_assert(std::__is_callable<decltype(func)>::value, "" ); |
27 | static_assert(!std::__is_callable<NotFunctor>::value, "" ); |
28 | static_assert(!std::__is_callable<NotFunctor, |
29 | decltype(&NotFunctor::compare)>::value, "" ); |
30 | static_assert(std::__is_callable<ArgumentFunctor, int, int>::value, "" ); |
31 | static_assert(!std::__is_callable<ArgumentFunctor, int>::value, "" ); |
32 | |