[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / thread / thread.mutex / thread.lock / thread.lock.shared / thread.lock.shared.obs / op_bool.pass.cpp
blob1186671ad04d2875055aafd33c40f108d5a48bf9
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
10 // UNSUPPORTED: c++03, c++11
12 // <shared_mutex>
14 // template <class Mutex> class shared_lock;
16 // explicit operator bool() const noexcept;
18 #include <shared_mutex>
19 #include <cassert>
20 #include <type_traits>
22 #include "test_macros.h"
24 struct M {
25 void lock_shared() {}
26 void unlock_shared() {}
29 int main(int, char**)
31 static_assert(std::is_constructible<bool, std::shared_lock<M>>::value, "");
32 static_assert(!std::is_convertible<std::shared_lock<M>, bool>::value, "");
34 M m;
35 std::shared_lock<M> lk0;
36 assert(static_cast<bool>(lk0) == false);
37 std::shared_lock<M> lk1(m);
38 assert(static_cast<bool>(lk1) == true);
39 lk1.unlock();
40 assert(static_cast<bool>(lk1) == false);
41 ASSERT_NOEXCEPT(static_cast<bool>(lk0));
43 return 0;