aboutsummaryrefslogtreecommitdiff
path: root/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/copy.fail.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/copy.fail.cpp')
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/copy.fail.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/copy.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/copy.fail.cpp
new file mode 100644
index 000000000000..5075a4268095
--- /dev/null
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/copy.fail.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <mutex>
+
+// template <class ...Mutex> class scoped_lock;
+
+// scoped_lock(scoped_lock const&) = delete;
+
+#include <mutex>
+#include "test_macros.h"
+
+int main()
+{
+ using M = std::mutex;
+ M m0, m1, m2;
+ {
+ using LG = std::scoped_lock<>;
+ const LG Orig;
+ LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}}
+ }
+ {
+ using LG = std::scoped_lock<M>;
+ const LG Orig(m0);
+ LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}}
+ }
+ {
+ using LG = std::scoped_lock<M, M>;
+ const LG Orig(m0, m1);
+ LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}}
+ }
+ {
+ using LG = std::scoped_lock<M, M, M>;
+ const LG Orig(m0, m1, m2);
+ LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}}
+ }
+}