2010-05-11 21:42:16 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2010-05-11 23:36:01 +02:00
|
|
|
// The LLVM Compiler Infrastructure
|
2010-05-11 21:42:16 +02:00
|
|
|
//
|
2010-11-16 23:09:02 +01:00
|
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
|
|
// Source Licenses. See LICENSE.TXT for details.
|
2010-05-11 21:42:16 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// test move
|
|
|
|
|
|
|
|
#include <utility>
|
|
|
|
#include <cassert>
|
|
|
|
|
|
|
|
class move_only
|
|
|
|
{
|
2010-09-05 01:28:19 +02:00
|
|
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2010-05-11 21:42:16 +02:00
|
|
|
move_only(const move_only&);
|
|
|
|
move_only& operator=(const move_only&);
|
2010-09-05 01:28:19 +02:00
|
|
|
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2010-05-11 21:42:16 +02:00
|
|
|
move_only(move_only&);
|
|
|
|
move_only& operator=(move_only&);
|
2010-09-05 01:28:19 +02:00
|
|
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2010-05-11 21:42:16 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2010-09-05 01:28:19 +02:00
|
|
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2010-05-11 21:42:16 +02:00
|
|
|
move_only(move_only&&) {}
|
2011-05-17 21:12:55 +02:00
|
|
|
move_only& operator=(move_only&&) {return *this;}
|
2010-09-05 01:28:19 +02:00
|
|
|
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2010-05-11 21:42:16 +02:00
|
|
|
operator std::__rv<move_only> () {return std::__rv<move_only>(*this);}
|
|
|
|
move_only(std::__rv<move_only>) {}
|
2010-09-05 01:28:19 +02:00
|
|
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2010-05-11 21:42:16 +02:00
|
|
|
|
|
|
|
move_only() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
move_only source() {return move_only();}
|
|
|
|
const move_only csource() {return move_only();}
|
|
|
|
|
|
|
|
void test(move_only) {}
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
move_only mo;
|
|
|
|
|
|
|
|
test(std::move(mo));
|
|
|
|
test(source());
|
|
|
|
}
|