1 //===----------------------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // UNSUPPORTED: libcpp-has-no-threads
11 // UNSUPPORTED: c++98, c++03, c++11, c++14
12
13 // <mutex>
14
15 // template <class ...Mutex> class scoped_lock;
16
17 // scoped_lock& operator=(scoped_lock const&) = delete;
18
19 #include <mutex>
20 #include "test_macros.h"
21
main()22 int main()
23 {
24 using M = std::mutex;
25 M m0, m1, m2;
26 M om0, om1, om2;
27 {
28 using LG = std::scoped_lock<>;
29 LG lg1, lg2;
30 lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}}
31 }
32 {
33 using LG = std::scoped_lock<M>;
34 LG lg1(m0);
35 LG lg2(om0);
36 lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}}
37 }
38 {
39 using LG = std::scoped_lock<M, M>;
40 LG lg1(m0, m1);
41 LG lg2(om0, om1);
42 lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}}
43 }
44 {
45 using LG = std::scoped_lock<M, M, M>;
46 LG lg1(m0, m1, m2);
47 LG lg2(om0, om1, om2);
48 lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}}
49 }
50 }
51