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 // mutex_type *mutex() const noexcept;
18 #include <shared_mutex>
21 #include "test_macros.h"
23 std::shared_timed_mutex m
;
27 std::shared_lock
<std::shared_timed_mutex
> lk0
;
28 assert(lk0
.mutex() == nullptr);
29 std::shared_lock
<std::shared_timed_mutex
> lk1(m
);
30 assert(lk1
.mutex() == &m
);
32 assert(lk1
.mutex() == &m
);
33 static_assert(noexcept(lk0
.mutex()), "mutex() must be noexcept");