[Flang] Add semantics checks for CrayPointer usage in DSA list (#123171)
[llvm-project.git] / libcxx / test / std / thread / thread.stoptoken / stoptoken / assign.copy.pass.cpp
blob753cf51c5b5144277baa5a9fc304d441cf057886
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, c++14, c++17
11 // XFAIL: availability-synchronization_library-missing
13 #include <cassert>
14 #include <concepts>
15 #include <stop_token>
16 #include <type_traits>
18 #include "test_macros.h"
20 static_assert(std::is_nothrow_copy_assignable_v<std::stop_token>);
22 int main(int, char**) {
24 std::stop_token st1;
26 std::stop_source source;
27 auto st2 = source.get_token();
29 assert(st1 != st2);
31 source.request_stop();
33 assert(!st1.stop_requested());
34 assert(st2.stop_requested());
36 std::same_as<std::stop_token&> decltype(auto) ref = st1 = st2;
37 assert(&ref == &st1);
39 assert(st1 == st2);
40 assert(st1.stop_requested());
41 assert(st2.stop_requested());
44 return 0;