1c9af0e61SArthur O'Dwyer //===----------------------------------------------------------------------===//
2c9af0e61SArthur O'Dwyer //
3c9af0e61SArthur O'Dwyer // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4c9af0e61SArthur O'Dwyer // See https://llvm.org/LICENSE.txt for license information.
5c9af0e61SArthur O'Dwyer // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6c9af0e61SArthur O'Dwyer //
7c9af0e61SArthur O'Dwyer //===----------------------------------------------------------------------===//
8c9af0e61SArthur O'Dwyer //
9*a7f9895cSLouis Dionne // UNSUPPORTED: no-threads
10c9af0e61SArthur O'Dwyer // UNSUPPORTED: c++03, c++11
11c9af0e61SArthur O'Dwyer 
12c9af0e61SArthur O'Dwyer // <semaphore>
13c9af0e61SArthur O'Dwyer 
14c9af0e61SArthur O'Dwyer // constexpr explicit counting_semaphore(ptrdiff_t desired);
15c9af0e61SArthur O'Dwyer 
16c9af0e61SArthur O'Dwyer #include <semaphore>
17c9af0e61SArthur O'Dwyer #include <type_traits>
18c9af0e61SArthur O'Dwyer 
19c9af0e61SArthur O'Dwyer #include "test_macros.h"
20c9af0e61SArthur O'Dwyer 
21c9af0e61SArthur O'Dwyer static_assert(!std::is_default_constructible<std::binary_semaphore>::value, "");
22c9af0e61SArthur O'Dwyer static_assert(!std::is_default_constructible<std::counting_semaphore<>>::value, "");
23c9af0e61SArthur O'Dwyer 
24c9af0e61SArthur O'Dwyer static_assert(!std::is_convertible<int, std::binary_semaphore>::value, "");
25c9af0e61SArthur O'Dwyer static_assert(!std::is_convertible<int, std::counting_semaphore<>>::value, "");
26c9af0e61SArthur O'Dwyer 
27d0eaf753SArthur O'Dwyer #if TEST_STD_VER > 17
28d0eaf753SArthur O'Dwyer // Test constexpr-constructibility. (But not destructibility.)
29c9af0e61SArthur O'Dwyer constinit std::binary_semaphore bs(1);
30c9af0e61SArthur O'Dwyer constinit std::counting_semaphore cs(1);
31c9af0e61SArthur O'Dwyer #endif
32