Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / thread / thread.semaphore / ctor.compile.pass.cpp
blob28ccc0124d489e48796380f88d1bb838196e4ca0
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, c++11
12 // <semaphore>
14 // constexpr explicit counting_semaphore(ptrdiff_t desired);
16 #include <semaphore>
17 #include <type_traits>
19 #include "test_macros.h"
21 static_assert(!std::is_default_constructible<std::binary_semaphore>::value, "");
22 static_assert(!std::is_default_constructible<std::counting_semaphore<>>::value, "");
24 static_assert(!std::is_convertible<int, std::binary_semaphore>::value, "");
25 static_assert(!std::is_convertible<int, std::counting_semaphore<>>::value, "");
27 #if TEST_STD_VER > 17
28 // Test constexpr-constructibility. (But not destructibility.)
29 constinit std::binary_semaphore bs(1);
30 constinit std::counting_semaphore<> cs(1);
31 #endif