brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · b7c8d53 Raw
32 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++14, c++1711 12// <semaphore>13 14// constexpr explicit counting_semaphore(ptrdiff_t desired);15 16#include <semaphore>17#include <type_traits>18 19#include "test_macros.h"20 21static_assert(!std::is_default_constructible<std::binary_semaphore>::value, "");22static_assert(!std::is_default_constructible<std::counting_semaphore<>>::value, "");23 24static_assert(!std::is_convertible<int, std::binary_semaphore>::value, "");25static_assert(!std::is_convertible<int, std::counting_semaphore<>>::value, "");26 27#if TEST_STD_VER > 1728// Test constexpr-constructibility. (But not destructibility.)29constinit std::binary_semaphore bs(1);30constinit std::counting_semaphore<> cs(1);31#endif32