Home | History | Annotate | Download | only in thread.lock.guard
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // UNSUPPORTED: libcpp-has-no-threads
     11 // UNSUPPORTED: c++98, c++03
     12 
     13 // <mutex>
     14 
     15 // template <class ...Mutex> class lock_guard;
     16 
     17 // lock_guard(lock_guard const&) = delete;
     18 
     19 // MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
     20 #define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
     21 #include <mutex>
     22 
     23 int main()
     24 {
     25     using M = std::mutex;
     26     M m0, m1, m2;
     27     {
     28         using LG = std::lock_guard<>;
     29         const LG Orig;
     30         LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}}
     31     }
     32     {
     33         using LG = std::lock_guard<M, M>;
     34         const LG Orig(m0, m1);
     35         LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}}
     36     }
     37     {
     38         using LG = std::lock_guard<M, M, M>;
     39         const LG Orig(m0, m1, m2);
     40         LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}}
     41     }
     42 }
     43