brintos

brintos / llvm-project-archived public Read only

0
0
Text · 830 B · 7fa01a8 Raw
32 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// jthread() noexcept;13 14#include <cassert>15#include <stop_token>16#include <thread>17#include <type_traits>18 19#include "test_macros.h"20 21static_assert(std::is_nothrow_default_constructible_v<std::jthread>);22 23int main(int, char**) {24  {25    std::jthread jt = {}; // implicit26    assert(!jt.get_stop_source().stop_possible());27    assert(jt.get_id() == std::jthread::id());28  }29 30  return 0;31}32