summaryrefslogtreecommitdiff
path: root/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-07-23 20:47:26 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-07-23 20:47:26 +0000
commit51072bd6bf79ef2bc6a922079bff57c31c1effbc (patch)
tree91a2effbc9e6f80bdbbf9eb70e06c51ad0867ea0 /test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp
parentbb5e33f003797b67974a8893f7f2930fc51b8210 (diff)
Notes
Diffstat (limited to 'test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp')
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp
new file mode 100644
index 0000000000000..866538a2834f5
--- /dev/null
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// <mutex>
+
+// template <class ...Mutex> class lock_guard;
+
+// explicit lock_guard(Mutex&...);
+
+#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
+#include <mutex>
+
+template <class LG>
+void test_conversion(LG) {}
+
+int main()
+{
+ using M = std::mutex;
+ M m0, m1, m2;
+ M n0, n1, n2;
+ {
+ using LG = std::lock_guard<>;
+ LG lg = {}; // expected-error{{chosen constructor is explicit in copy-initialization}}
+ test_conversion<LG>({}); // expected-error{{no matching function for call}}
+ ((void)lg);
+ }
+ {
+ using LG = std::lock_guard<M, M>;
+ LG lg = {m0, m1}; // expected-error{{chosen constructor is explicit in copy-initialization}}
+ test_conversion<LG>({n0, n1}); // expected-error{{no matching function for call}}
+ ((void)lg);
+ }
+ {
+ using LG = std::lock_guard<M, M, M>;
+ LG lg = {m0, m1, m2}; // expected-error{{chosen constructor is explicit in copy-initialization}}
+ test_conversion<LG>({n0, n1, n2}); // expected-error{{no matching function for call}}
+ }
+}