Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / thread / thread.mutex / thread.lock / thread.lock.scoped / mutex.verify.cpp
blob44f1ee37e6afa7989c67334d9d8c0482851440e7
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 // explicit scoped_lock(Mutex&...);
18 #include <mutex>
19 #include "test_macros.h"
21 template <class LG>
22 void test_conversion(LG) {}
24 int main(int, char**)
26 using M = std::mutex;
27 M m0, m1, m2;
28 M n0, n1, n2;
30 using LG = std::scoped_lock<>;
31 LG lg = {}; // expected-error{{chosen constructor is explicit in copy-initialization}}
32 test_conversion<LG>({}); // expected-error{{no matching function for call}}
33 ((void)lg);
36 using LG = std::scoped_lock<M>;
37 LG lg = {m0}; // expected-error{{chosen constructor is explicit in copy-initialization}}
38 test_conversion<LG>({n0}); // expected-error{{no matching function for call}}
39 ((void)lg);
42 using LG = std::scoped_lock<M, M>;
43 LG lg = {m0, m1}; // expected-error{{chosen constructor is explicit in copy-initialization}}
44 test_conversion<LG>({n0, n1}); // expected-error{{no matching function for call}}
45 ((void)lg);
48 using LG = std::scoped_lock<M, M, M>;
49 LG lg = {m0, m1, m2}; // expected-error{{chosen constructor is explicit in copy-initialization}}
50 test_conversion<LG>({n0, n1, n2}); // expected-error{{no matching function for call}}
53 return 0;