Imported Upstream version 1.51.0
[platform/upstream/boost.git] / libs / thread / test / sync / mutual_exclusion / locks / reverse_lock / copy_assign_fail.cpp
1 // Copyright (C) 2012 Vicente J. Botet Escriba
2 //
3 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
4 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 // <boost/thread/locks.hpp>
7
8 // template <class Mutex> class reverse_lock;
9
10 // reverse_lock& operator=(reverse_lock const&) = delete;
11
12 #include <boost/thread/locks.hpp>
13 #include <boost/thread/reverse_lock.hpp>
14 #include <boost/thread/mutex.hpp>
15 #include <boost/detail/lightweight_test.hpp>
16
17
18 int main()
19 {
20   boost::mutex m0;
21   boost::mutex m1;
22   boost::unique_lock<boost::mutex> lk0(m0);
23   boost::unique_lock<boost::mutex> lk1(m1);
24   {
25     boost::reverse_lock<boost::unique_lock<boost::mutex> > lg0(lk0);
26     boost::reverse_lock<boost::unique_lock<boost::mutex> > lg1(lk1);
27     lg1 = lg0;
28   }
29
30 }
31
32 void remove_unused_warning()
33 {
34   //../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
35   //../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
36   //../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
37
38   (void)boost::system::posix_category;
39   (void)boost::system::errno_ecat;
40   (void)boost::system::native_ecat;
41 }