xref: /llvm-project/libcxx/test/std/thread/thread.semaphore/max.pass.cpp (revision 9ebc6f5d6d333ec38d9a8231414bbd4d58fa83e9)
154fa9ecdSOlivier Giroux //===----------------------------------------------------------------------===//
254fa9ecdSOlivier Giroux //
354fa9ecdSOlivier Giroux // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
454fa9ecdSOlivier Giroux // See https://llvm.org/LICENSE.txt for license information.
554fa9ecdSOlivier Giroux // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
654fa9ecdSOlivier Giroux //
754fa9ecdSOlivier Giroux //===----------------------------------------------------------------------===//
854fa9ecdSOlivier Giroux //
9a7f9895cSLouis Dionne // UNSUPPORTED: no-threads
10bf1666fbSLouis Dionne // UNSUPPORTED: c++03, c++11, c++14, c++17
119ddedf07SLouis Dionne 
1254fa9ecdSOlivier Giroux // <semaphore>
1354fa9ecdSOlivier Giroux 
14*9ebc6f5dSNikolas Klauser #include <cstddef>
1554fa9ecdSOlivier Giroux #include <semaphore>
1654fa9ecdSOlivier Giroux 
1754fa9ecdSOlivier Giroux int main(int, char**)
1854fa9ecdSOlivier Giroux {
19c9af0e61SArthur O'Dwyer   static_assert(std::counting_semaphore<>::max() >= 1, "");
2054fa9ecdSOlivier Giroux   static_assert(std::counting_semaphore<1>::max() >= 1, "");
21c9af0e61SArthur O'Dwyer   static_assert(std::counting_semaphore<std::numeric_limits<int>::max()>::max() >= std::numeric_limits<int>::max(), "");
22d8681356SMark de Wever   static_assert(std::counting_semaphore<std::numeric_limits<std::ptrdiff_t>::max()>::max() == std::numeric_limits<ptrdiff_t>::max(), "");
2354fa9ecdSOlivier Giroux   return 0;
2454fa9ecdSOlivier Giroux }
25