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 // bool owns_lock() 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
.owns_lock() == false);
29 std::shared_lock
<std::shared_timed_mutex
> lk1(m
);
30 assert(lk1
.owns_lock() == true);
32 assert(lk1
.owns_lock() == false);
33 static_assert(noexcept(lk0
.owns_lock()), "owns_lock must be noexcept");