1*695138caSHui //===----------------------------------------------------------------------===// 2*695138caSHui // 3*695138caSHui // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*695138caSHui // See https://llvm.org/LICENSE.txt for license information. 5*695138caSHui // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*695138caSHui // 7*695138caSHui //===----------------------------------------------------------------------===// 8*695138caSHui // 9*695138caSHui // UNSUPPORTED: no-threads 10*695138caSHui // UNSUPPORTED: c++03, c++11, c++14, c++17 11*695138caSHui // XFAIL: availability-synchronization_library-missing 12*695138caSHui 13*695138caSHui // jthread() noexcept; 14*695138caSHui 15*695138caSHui #include <cassert> 16*695138caSHui #include <stop_token> 17*695138caSHui #include <thread> 18*695138caSHui #include <type_traits> 19*695138caSHui 20*695138caSHui #include "test_macros.h" 21*695138caSHui 22*695138caSHui static_assert(std::is_nothrow_default_constructible_v<std::jthread>); 23*695138caSHui 24*695138caSHui int main(int, char**) { 25*695138caSHui { 26*695138caSHui std::jthread jt = {}; // implicit 27*695138caSHui assert(!jt.get_stop_source().stop_possible()); 28*695138caSHui assert(jt.get_id() == std::jthread::id()); 29*695138caSHui } 30*695138caSHui 31*695138caSHui return 0; 32*695138caSHui } 33