[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / thread / thread.stoptoken / stopsource / swap.member.pass.cpp
blobbab19147b86b40fdd945c6b2c9ecc66d08fa5bd1
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
14 // void swap(stop_source& rhs) noexcept;
16 #include <cassert>
17 #include <concepts>
18 #include <stop_token>
19 #include <type_traits>
21 #include "test_macros.h"
23 template <class T>
24 concept IsNoThrowMemberSwappable = requires(T& t) {
25 { t.swap(t) } noexcept;
28 static_assert(IsNoThrowMemberSwappable<std::stop_source>);
30 int main(int, char**) {
32 std::stop_source ss1;
33 std::stop_source ss2;
35 assert(ss1 != ss2);
37 ss2.request_stop();
39 assert(!ss1.stop_requested());
40 assert(ss2.stop_requested());
42 ss1.swap(ss2);
44 assert(ss1 != ss2);
45 assert(ss1.stop_requested());
46 assert(!ss2.stop_requested());
49 return 0;