[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / thread / thread.mutex / thread.lock / thread.lock.unique / thread.lock.unique.obs / op_bool.pass.cpp
blobea05eb7d023a9f843a9873571d4b1a1fe0f3a9c0
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 //===----------------------------------------------------------------------===//
8 //
9 // UNSUPPORTED: no-threads
11 // <mutex>
13 // template <class Mutex> class unique_lock;
15 // explicit operator bool() const noexcept;
17 #include <mutex>
18 #include <cassert>
19 #include <type_traits>
21 #include "test_macros.h"
23 std::mutex m;
25 int main(int, char**)
27 static_assert(std::is_constructible<bool, std::unique_lock<std::mutex> >::value, "");
28 static_assert(!std::is_convertible<std::unique_lock<std::mutex>, bool>::value, "");
30 std::unique_lock<std::mutex> lk0;
31 assert(static_cast<bool>(lk0) == false);
32 std::unique_lock<std::mutex> lk1(m);
33 assert(static_cast<bool>(lk1) == true);
34 lk1.unlock();
35 assert(static_cast<bool>(lk1) == false);
36 ASSERT_NOEXCEPT(static_cast<bool>(lk0));
38 return 0;