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 // explicit unique_lock(mutex_type& m);
15 // template<class _Mutex> unique_lock(unique_lock<_Mutex>)
16 // -> unique_lock<_Mutex>; // C++17
21 #include "checking_mutex.h"
22 #include "test_macros.h"
24 int main(int, char**) {
28 std::unique_lock
<checking_mutex
> lock(mux
);
29 assert(mux
.current_state
== checking_mutex::locked_via_lock
);
31 assert(mux
.current_state
== checking_mutex::unlocked
);
33 #if TEST_STD_VER >= 17
34 static_assert(std::is_same_v
<std::unique_lock
<checking_mutex
>, decltype(std::unique_lock
{mux
})>, "");