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& operator=(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     M om0, om1, om2;
     28     {
     29         using LG = std::lock_guard<>;
     30         LG lg1, lg2;
     31         lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}}
     32     }
     33     {
     34         using LG = std::lock_guard<M, M>;
     35         LG lg1(m0, m1);
     36         LG lg2(om0, om1);
     37         lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}}
     38     }
     39     {
     40         using LG = std::lock_guard<M, M, M>;
     41         LG lg1(m0, m1, m2);
     42         LG lg2(om0, om1, om2);
     43         lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}}
     44     }
     45 }
     46