aboutsummaryrefslogtreecommitdiff
path: root/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp')
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp
new file mode 100644
index 000000000000..aa640ee6d746
--- /dev/null
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <mutex>
+
+// template <class Mutex> class unique_lock;
+
+// unique_lock(unique_lock&& u);
+
+#include <mutex>
+#include <cassert>
+
+std::mutex m;
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ std::unique_lock<std::mutex> lk0(m);
+ std::unique_lock<std::mutex> lk = std::move(lk0);
+ assert(lk.mutex() == &m);
+ assert(lk.owns_lock() == true);
+ assert(lk0.mutex() == nullptr);
+ assert(lk0.owns_lock() == false);
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}