| 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 |
// UNSUPPORTED: no-threads |
| 10 |
// UNSUPPORTED: c++03, c++11, c++14 |
| 11 |
|
| 12 |
// <mutex> |
| 13 |
|
| 14 |
// template <class ...Mutex> class scoped_lock; |
| 15 |
|
| 16 |
// scoped_lock& operator=(scoped_lock const&) = delete; |
| 17 |
|
| 18 |
#include <mutex> |
| 19 |
#include "test_macros.h" |
| 20 |
|
| 21 |
int main(int, char**) |
| 22 |
{ |
| 23 |
using M = std::mutex; |
| 24 |
M m0, m1, m2; |
| 25 |
M om0, om1, om2; |
| 26 |
{ |
| 27 |
using LG = std::scoped_lock<>; |
| 28 |
LG lg1, lg2; |
| 29 |
lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}} |
| 30 |
} |
| 31 |
{ |
| 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 '='}} |
| 36 |
} |
| 37 |
{ |
| 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 '='}} |
| 42 |
} |
| 43 |
{ |
| 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 '='}} |
| 48 |
} |
| 49 |
|
| 50 |
return 0; |
| 51 |
} |