[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.cons / move_ctor.pass.cpp
blobfa3c689398aaa4feaeacf7c0eb87963e244ed6ac
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 // shared_lock(shared_lock&& u);
18 #include <shared_mutex>
19 #include <cassert>
20 #include "nasty_containers.h"
22 #include "test_macros.h"
24 int main(int, char**)
27 typedef std::shared_timed_mutex M;
28 M m;
29 std::shared_lock<M> lk0(m);
30 std::shared_lock<M> lk = std::move(lk0);
31 assert(lk.mutex() == std::addressof(m));
32 assert(lk.owns_lock() == true);
33 assert(lk0.mutex() == nullptr);
34 assert(lk0.owns_lock() == false);
37 typedef nasty_mutex M;
38 M m;
39 std::shared_lock<M> lk0(m);
40 std::shared_lock<M> lk = std::move(lk0);
41 assert(lk.mutex() == std::addressof(m));
42 assert(lk.owns_lock() == true);
43 assert(lk0.mutex() == nullptr);
44 assert(lk0.owns_lock() == false);
47 return 0;