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 // UNSUPPORTED: c++03 10 11 // <functional> 12 13 #include <functional> 14 15 #include "test_macros.h" 16 17 struct Incomplete; 18 template<class T> struct Holder { T t; }; 19 typedef Holder<Incomplete> *Ptr; 20 21 Ptr no_args() { return nullptr; } 22 Ptr one_arg(Ptr p) { return p; } 23 Ptr two_args(Ptr p, Ptr) { return p; } 24 Ptr three_args(Ptr p, Ptr, Ptr) { return p; } 25 Ptr four_args(Ptr p, Ptr, Ptr, Ptr) { return p; } 26 27 void one_arg_void(Ptr) { } 28 29 int main(int, char**) 30 { 31 Ptr x = nullptr; 32 std::function<Ptr()> f(no_args); f(); 33 std::function<Ptr(Ptr)> g(one_arg); g(x); 34 std::function<void(Ptr)> h(one_arg_void); h(x); 35 return 0; 36 } 37