[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.mod / member_swap.pass.cpp
blobaeca2022ba9c9d534bb4d0a94288559358430967
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 // void swap(shared_lock& u) noexcept;
18 #include <shared_mutex>
19 #include <cassert>
21 #include "test_macros.h"
23 struct mutex
25 void lock_shared() {}
26 void unlock_shared() {}
29 mutex m;
31 int main(int, char**)
33 std::shared_lock<mutex> lk1(m);
34 std::shared_lock<mutex> lk2;
35 lk1.swap(lk2);
36 assert(lk1.mutex() == nullptr);
37 assert(lk1.owns_lock() == false);
38 assert(lk2.mutex() == &m);
39 assert(lk2.owns_lock() == true);
40 static_assert(noexcept(lk1.swap(lk2)), "member swap must be noexcept");
42 return 0;