16015dd11SMarshall Clow //===----------------------------------------------------------------------===//
26015dd11SMarshall Clow //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66015dd11SMarshall Clow //
76015dd11SMarshall Clow //===----------------------------------------------------------------------===//
86015dd11SMarshall Clow 
9*a7f9895cSLouis Dionne // UNSUPPORTED: no-threads
1031cbe0f2SLouis Dionne // UNSUPPORTED: c++03, c++11, c++14
116015dd11SMarshall Clow 
126015dd11SMarshall Clow // <mutex>
136015dd11SMarshall Clow 
146015dd11SMarshall Clow // template <class ...Mutex> class scoped_lock;
156015dd11SMarshall Clow 
166015dd11SMarshall Clow // scoped_lock& operator=(scoped_lock const&) = delete;
176015dd11SMarshall Clow 
186015dd11SMarshall Clow #include <mutex>
196015dd11SMarshall Clow #include "test_macros.h"
206015dd11SMarshall Clow 
main(int,char **)212df59c50SJF Bastien int main(int, char**)
226015dd11SMarshall Clow {
236015dd11SMarshall Clow     using M = std::mutex;
246015dd11SMarshall Clow     M m0, m1, m2;
256015dd11SMarshall Clow     M om0, om1, om2;
266015dd11SMarshall Clow     {
276015dd11SMarshall Clow         using LG = std::scoped_lock<>;
286015dd11SMarshall Clow         LG lg1, lg2;
296015dd11SMarshall Clow         lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}}
306015dd11SMarshall Clow     }
316015dd11SMarshall Clow     {
326015dd11SMarshall Clow         using LG = std::scoped_lock<M>;
336015dd11SMarshall Clow         LG lg1(m0);
346015dd11SMarshall Clow         LG lg2(om0);
356015dd11SMarshall Clow         lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}}
366015dd11SMarshall Clow     }
376015dd11SMarshall Clow     {
386015dd11SMarshall Clow         using LG = std::scoped_lock<M, M>;
396015dd11SMarshall Clow         LG lg1(m0, m1);
406015dd11SMarshall Clow         LG lg2(om0, om1);
416015dd11SMarshall Clow         lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}}
426015dd11SMarshall Clow     }
436015dd11SMarshall Clow     {
446015dd11SMarshall Clow         using LG = std::scoped_lock<M, M, M>;
456015dd11SMarshall Clow         LG lg1(m0, m1, m2);
466015dd11SMarshall Clow         LG lg2(om0, om1, om2);
476015dd11SMarshall Clow         lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}}
486015dd11SMarshall Clow     }
492df59c50SJF Bastien 
502df59c50SJF Bastien   return 0;
516015dd11SMarshall Clow }
52