| 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: no-threads |
| 10 | // UNSUPPORTED: c++03 |
| 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 | // constexpr defer_lock_t defer_lock{}; |
| 19 | // constexpr try_to_lock_t try_to_lock{}; |
| 20 | // constexpr adopt_lock_t adopt_lock{}; |
| 21 | |
| 22 | #include <mutex> |
| 23 | |
| 24 | #include "test_macros.h" |
| 25 | |
| 26 | int main(int, char**) |
| 27 | { |
| 28 | typedef std::defer_lock_t T1; |
| 29 | typedef std::try_to_lock_t T2; |
| 30 | typedef std::adopt_lock_t T3; |
| 31 | |
| 32 | T1 t1 = std::defer_lock; ((void)t1); |
| 33 | T2 t2 = std::try_to_lock; ((void)t2); |
| 34 | T3 t3 = std::adopt_lock; ((void)t3); |
| 35 | |
| 36 | return 0; |
| 37 | } |
| 38 | |