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-exception
6//
7//===----------------------------------------------------------------------===//
8
9// UNSUPPORTED: c++03
10// UNSUPPORTED: no-threads
11
12// <mutex>
13
14// struct defer_lock_t { explicit defer_lock_t() = default; };
15// struct try_to_lock_t { explicit try_to_lock_t() = default; };
16// struct adopt_lock_t { explicit adopt_lock_t() = default; };
17
18// This test checks for https://wg21.link/LWG2510.
19
20#include <mutex>
21
22std::defer_lock_t f1() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
23std::try_to_lock_t f2() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
24std::adopt_lock_t f3() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
25

source code of libcxx/test/std/thread/thread.mutex/thread.lock/types.verify.cpp