Debian Codegraph @

libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_assign.compile.fail.cpp

raw
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 // <mutex>
10
11 // template <class Mutex> class unique_lock;
12
13 // unique_lock& operator=(unique_lock const&) = delete;
14
15 #include <mutex>
16 #include <cassert>
17
18 int main(int, char**)
19 {
20 {
21 typedef std::mutex M;
22 M m0;
23 M m1;
24 std::unique_lock<M> lk0(m0);
25 std::unique_lock<M> lk1(m1);
26 lk1 = lk0;
27 assert(lk1.mutex() == &m0);
28 assert(lk1.owns_lock() == true);
29 assert(lk0.mutex() == nullptr);
30 assert(lk0.owns_lock() == false);
31 }
32
33 return 0;
34 }