[NFC][analyzer][docs] Improve Annotations.rst (#122749)
[llvm-project.git] / libcxx / test / std / thread / thread.mutex / thread.lock / thread.lock.scoped / assign.verify.cpp
blob9d5fd6049e0c7880277a03058b3aed4615207a2f
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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: no-threads
10 // UNSUPPORTED: c++03, c++11, c++14
12 // <mutex>
14 // template <class ...Mutex> class scoped_lock;
16 // scoped_lock& operator=(scoped_lock const&) = delete;
18 #include <mutex>
19 #include "test_macros.h"
21 int main(int, char**)
23 using M = std::mutex;
24 M m0, m1, m2;
25 M om0, om1, om2;
27 using LG = std::scoped_lock<>;
28 LG lg1, lg2;
29 lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}}
32 using LG = std::scoped_lock<M>;
33 LG lg1(m0);
34 LG lg2(om0);
35 lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}}
38 using LG = std::scoped_lock<M, M>;
39 LG lg1(m0, m1);
40 LG lg2(om0, om1);
41 lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}}
44 using LG = std::scoped_lock<M, M, M>;
45 LG lg1(m0, m1, m2);
46 LG lg2(om0, om1, om2);
47 lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}}
50 return 0;