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 <cassert>
22 
23 #include "test_macros.h"
24 
25 class A
26 {
27     int data_[10];
28 public:
29     static int count;
30 
31     A()
32     {
33         ++count;
34         for (int i = 0; i < 10; ++i)
35             data_[i] = i;
36     }
37 
38     A(const A&) {++count;}
39 
40     ~A() {--count;}
41 
42     int operator()(int i) const
43     {
44         for (int j = 0; j < 10; ++j)
45             i += data_[j];
46         return i;
47     }
48 };
49 
50 int A::count = 0;
51 
52 int g(int) { return 0; }
53 
54 int main(int, char**)
55 {
56     std::function<int(int)> f = A();
57     std::function<int(int)> f2(std::allocator_arg, std::allocator<A>(), std::move(f)); // expected-error {{no matching constructor for initialization of}}
58     return 0;
59 }
60