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
13
14// [[nodiscard]] bool joinable() const noexcept;
15// [[nodiscard]] id get_id() const noexcept;
16// [[nodiscard]] native_handle_type native_handle();
17// [[nodiscard]] stop_source get_stop_source() noexcept;
18// [[nodiscard]] stop_token get_stop_token() const noexcept;
19// [[nodiscard]] static unsigned int hardware_concurrency() noexcept;
20
21#include <thread>
22
23void test() {
24 std::jthread jt;
25 jt.joinable(); // expected-warning {{ignoring return value of function}}
26 jt.get_id(); // expected-warning {{ignoring return value of function}}
27 jt.native_handle(); // expected-warning {{ignoring return value of function}}
28 jt.get_stop_source(); // expected-warning {{ignoring return value of function}}
29 jt.get_stop_token(); // expected-warning {{ignoring return value of function}}
30 jt.hardware_concurrency(); // expected-warning {{ignoring return value of function}}
31}
32

source code of libcxx/test/std/thread/thread.jthread/nodiscard.verify.cpp