49 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// stop_source(stop_source&&) noexcept;13 14#include <cassert>15#include <stop_token>16#include <type_traits>17#include <utility>18 19#include "test_macros.h"20 21static_assert(std::is_nothrow_move_constructible_v<std::stop_source>);22 23int main(int, char**) {24 {25 std::stop_source source;26 27 assert(source.stop_possible());28 assert(!source.stop_requested());29 30 std::stop_source source2{std::move(source)};31 32 assert(!source.stop_possible());33 assert(!source.stop_requested());34 35 assert(source2.stop_possible());36 assert(!source2.stop_requested());37 38 source2.request_stop();39 40 assert(!source.stop_possible());41 assert(!source.stop_requested());42 43 assert(source2.stop_possible());44 assert(source2.stop_requested());45 }46 47 return 0;48}49