brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 37e60b8 Raw
48 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: no-threads10// UNSUPPORTED: c++03, c++11, c++1411 12// <mutex>13 14// template <class ...Mutex> class scoped_lock;15 16// scoped_lock(scoped_lock const&) = delete;17 18#include <mutex>19#include "test_macros.h"20 21int main(int, char**)22{23    using M = std::mutex;24    M m0, m1, m2;25    {26        using LG = std::scoped_lock<>;27        const LG Orig;28        LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}}29    }30    {31        using LG = std::scoped_lock<M>;32        const LG Orig(m0);33        LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}}34    }35    {36        using LG = std::scoped_lock<M, M>;37        const LG Orig(m0, m1);38        LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}}39    }40    {41        using LG = std::scoped_lock<M, M, M>;42        const LG Orig(m0, m1, m2);43        LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}}44    }45 46  return 0;47}48