• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <functional>
11 
12 // template <class F, class ...Args>
13 // result_of_t<F&&(Args&&...)> invoke(F&&, Args&&...);
14 
15 #include <functional>
16 #include <cassert>
17 
18 #include "test_macros.h"
19 
20 #if TEST_STD_VER <= 14
21 # ifdef __cpp_lib_invoke
22 #   error Feature test macro should be defined
23 # endif
24 #else
25 # ifndef __cpp_lib_invoke
26 #   error Feature test macro not defined
27 # endif
28 # if __cpp_lib_invoke != 201411
29 #   error __cpp_lib_invoke has the wrong value
30 # endif
31 #endif
32 
foo(int)33 int foo(int) { return 42; }
34 
main()35 int main() {
36 #if defined(__cpp_lib_invoke)
37   assert(std::invoke(foo, 101) == 42);
38 #endif
39 }