Add PR check to suggest alternatives to using undef (#118506)
[llvm-project.git] / libcxx / test / std / thread / thread.jthread / nodiscard.verify.cpp
blob35fcc03968c0f373df751ec1303fde2e47bf8828
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
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;
20 #include <thread>
22 void 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}}