[lldb] Make SBProgress move-only (#124843)
[llvm-project.git] / libcxx / test / std / thread / thread.mutex / thread.lock / thread.lock.unique / thread.lock.unique.cons / move_ctor.pass.cpp
blob7dab92ab69d987294694032621a66fb484526bb5
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // <mutex>
11 // template <class Mutex> class unique_lock;
13 // unique_lock(unique_lock&& u);
15 #include <cassert>
16 #include <memory>
17 #include <mutex>
18 #include <type_traits>
20 #include "checking_mutex.h"
21 #include "test_macros.h"
23 #if TEST_STD_VER >= 11
24 static_assert(std::is_nothrow_move_constructible<std::unique_lock<checking_mutex>>::value, "");
25 #endif
27 int main(int, char**) {
28 checking_mutex m;
29 std::unique_lock<checking_mutex> lk0(m);
30 std::unique_lock<checking_mutex> lk = std::move(lk0);
32 assert(lk.mutex() == std::addressof(m));
33 assert(lk.owns_lock());
34 assert(lk0.mutex() == nullptr);
35 assert(!lk0.owns_lock());
37 return 0;