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

Provided by KDAB

Privacy Policy
Improve your Profiling and Debugging skills
Find out more

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