summaryrefslogtreecommitdiff
path: root/libs/thread/test/sync/mutual_exclusion/locks/shared_lock/cons/copy_ctor_fail.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/thread/test/sync/mutual_exclusion/locks/shared_lock/cons/copy_ctor_fail.cpp')
-rwxr-xr-xlibs/thread/test/sync/mutual_exclusion/locks/shared_lock/cons/copy_ctor_fail.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/libs/thread/test/sync/mutual_exclusion/locks/shared_lock/cons/copy_ctor_fail.cpp b/libs/thread/test/sync/mutual_exclusion/locks/shared_lock/cons/copy_ctor_fail.cpp
new file mode 100755
index 0000000000..1756a63342
--- /dev/null
+++ b/libs/thread/test/sync/mutual_exclusion/locks/shared_lock/cons/copy_ctor_fail.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// Copyright (C) 2011 Vicente J. Botet Escriba
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// <boost/thread/locks.hpp>
+
+// template <class Mutex> class shared_lock;
+
+// shared_lock(shared_lock const&) = delete;
+
+
+#include <boost/thread/locks.hpp>
+#include <boost/thread/shared_mutex.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+boost::shared_mutex m0;
+boost::shared_mutex m1;
+
+int main()
+{
+ boost::shared_lock<boost::shared_mutex> lk0(m0);
+ boost::shared_lock<boost::shared_mutex> lk1 = lk0;
+ BOOST_TEST(lk1.mutex() == &m1);
+ BOOST_TEST(lk1.owns_lock() == true);
+ BOOST_TEST(lk0.mutex() == 0);
+ BOOST_TEST(lk0.owns_lock() == false);
+}
+
+void remove_unused_warning()
+{
+ //../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
+ //../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
+ //../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
+
+ (void)boost::system::posix_category;
+ (void)boost::system::errno_ecat;
+ (void)boost::system::native_ecat;
+}