1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
11 // template <class Mutex> class unique_lock;
13 // template <class Mutex>
14 // void swap(unique_lock<Mutex>& x, unique_lock<Mutex>& y);
20 #include "checking_mutex.h"
21 #include "test_macros.h"
23 #if TEST_STD_VER >= 11
24 static_assert(noexcept(swap(std::declval
<std::unique_lock
<checking_mutex
>&>(),
25 std::declval
<std::unique_lock
<checking_mutex
>&>())),
29 int main(int, char**) {
31 std::unique_lock
<checking_mutex
> lock1(mux
);
32 std::unique_lock
<checking_mutex
> lock2
;
36 assert(lock1
.mutex() == nullptr);
37 assert(!lock1
.owns_lock());
38 assert(lock2
.mutex() == std::addressof(mux
));
39 assert(lock2
.owns_lock() == true);