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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: no-threads
10 // UNSUPPORTED: c++03, c++11
14 // template <class Mutex> class shared_lock;
16 // shared_lock(shared_lock&& u);
18 #include <shared_mutex>
20 #include "nasty_containers.h"
22 #include "test_macros.h"
27 typedef std::shared_timed_mutex 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
;
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);