]>
Commit | Line | Data |
---|---|---|
52066eae | 1 | // { dg-do run { target c++11 } } |
7cc9022f | 2 | // { dg-require-effective-target hosted } |
7aec2c63 | 3 | |
7adcbafe | 4 | // Copyright (C) 2009-2022 Free Software Foundation, Inc. |
7aec2c63 PC |
5 | // |
6 | // This file is part of the GNU ISO C++ Library. This library is free | |
7 | // software; you can redistribute it and/or modify it under the | |
8 | // terms of the GNU General Public License as published by the | |
9 | // Free Software Foundation; either version 3, or (at your option) | |
10 | // any later version. | |
11 | ||
12 | // This library is distributed in the hope that it will be useful, | |
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | // GNU General Public License for more details. | |
16 | ||
17 | // You should have received a copy of the GNU General Public License along | |
18 | // with this library; see the file COPYING3. If not see | |
19 | // <http://www.gnu.org/licenses/>. | |
20 | ||
21 | #include <functional> | |
22 | ||
23 | struct moveable | |
24 | { | |
25 | moveable() = default; | |
26 | ~moveable() = default; | |
27 | moveable(const moveable& c) = delete; | |
28 | moveable& operator=(const moveable&) = delete; | |
29 | moveable(moveable&&) { } | |
30 | }; | |
31 | ||
32 | void f1(moveable) { } | |
33 | void f2(moveable&&) { } | |
34 | struct { void operator()(moveable&&) { } } f3; | |
35 | ||
36 | void test01() | |
37 | { | |
38 | std::function<void (moveable)> fo1a(f1); | |
39 | fo1a(moveable()); | |
40 | ||
41 | std::function<void (moveable)> fo2a(f2); | |
42 | fo2a(moveable()); | |
43 | ||
44 | std::function<void (moveable)> fo3a(f3); | |
45 | fo3a(moveable()); | |
46 | ||
47 | std::function<void (moveable&&)> fo1b(f1); | |
48 | fo1b(moveable()); | |
49 | ||
50 | std::function<void (moveable&&)> fo2b(f2); | |
51 | fo2b(moveable()); | |
52 | ||
53 | std::function<void (moveable&&)> fo3b(f3); | |
54 | fo3b(moveable()); | |
55 | } | |
56 | ||
57 | int main() | |
58 | { | |
59 | test01(); | |
60 | ||
61 | return 0; | |
62 | } |