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#include <utility>
13#include <cassert>
14
15class move_only
16{
17#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
18    move_only(const move_only&);
19    move_only& operator=(const move_only&);
20#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
21    move_only(move_only&);
22    move_only& operator=(move_only&);
23#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
24
25public:
26
27#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
28    move_only(move_only&&) {}
29    move_only& operator=(move_only&&) {return *this;}
30#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
31    operator std::__rv<move_only> () {return std::__rv<move_only>(*this);}
32    move_only(std::__rv<move_only>) {}
33#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
34
35    move_only() {}
36};
37
38move_only source() {return move_only();}
39const move_only csource() {return move_only();}
40
41void test(move_only) {}
42
43int main()
44{
45    move_only mo;
46
47    test(std::move(mo));
48    test(source());
49}
50