]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/utilities/utility/forward/move_only.pass.cpp
Vendor import of libc++ release_39 branch r287912:
[FreeBSD/FreeBSD.git] / test / std / utilities / utility / forward / move_only.pass.cpp
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 // test move
11
12 // UNSUPPORTED: c++98, c++03
13
14 #include <utility>
15 #include <cassert>
16
17 class move_only
18 {
19     move_only(const move_only&);
20     move_only& operator=(const move_only&);
21 public:
22     move_only(move_only&&) {}
23     move_only& operator=(move_only&&) {return *this;}
24
25     move_only() {}
26 };
27
28 move_only source() {return move_only();}
29 const move_only csource() {return move_only();}
30
31 void test(move_only) {}
32
33 int main()
34 {
35     move_only mo;
36
37     test(std::move(mo));
38     test(source());
39 }