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: libcpp-has-no-experimental-stop_token |
11 | // UNSUPPORTED: c++03, c++11, c++14, c++17 |
12 | // XFAIL: availability-synchronization_library-missing |
13 | |
14 | // explicit stop_source(nostopstate_t) noexcept; |
15 | |
16 | #include <cassert> |
17 | #include <stop_token> |
18 | #include <type_traits> |
19 | |
20 | #include "test_macros.h" |
21 | |
22 | static_assert(std::is_nothrow_constructible_v<std::stop_source, std::nostopstate_t>); |
23 | // explicit |
24 | static_assert(!std::is_convertible_v<std::nostopstate_t, std::stop_source>); |
25 | |
26 | int main(int, char**) { |
27 | { |
28 | std::stop_source ss(std::nostopstate); |
29 | assert(!ss.stop_possible()); |
30 | assert(!ss.stop_requested()); |
31 | } |
32 | |
33 | return 0; |
34 | } |
35 | |