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 // <functional> 10 11 // UNSUPPORTED: c++03, c++11, c++14 12 13 // class function<R(ArgTypes...)> 14 15 // template<class A> function(allocator_arg_t, const A&, function&&); 16 // 17 // This signature was removed in C++17 18 19 #include <functional> 20 #include <memory> 21 #include <utility> 22 23 class A 24 { 25 int data_[10]; 26 public: 27 static int count; 28 A()29 A() 30 { 31 ++count; 32 for (int i = 0; i < 10; ++i) 33 data_[i] = i; 34 } 35 A(const A &)36 A(const A&) {++count;} 37 ~A()38 ~A() {--count;} 39 operator ()(int i) const40 int operator()(int i) const 41 { 42 for (int j = 0; j < 10; ++j) 43 i += data_[j]; 44 return i; 45 } 46 }; 47 48 int A::count = 0; 49 g(int)50int g(int) { return 0; } 51 f()52void f() { 53 std::function<int(int)> f = A(); 54 std::function<int(int)> f2(std::allocator_arg, std::allocator<A>(), std::move(f)); // expected-error {{no matching constructor for initialization of}} 55 } 56