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: libcpp-has-no-threads 10 // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 11 // REQUIRES: verify-support 12 13 // <future> 14 15 // template <class F, class... Args> 16 // future<typename result_of<F(Args...)>::type> 17 // async(F&& f, Args&&... args); 18 19 // template <class F, class... Args> 20 // future<typename result_of<F(Args...)>::type> 21 // async(launch policy, F&& f, Args&&... args); 22 23 24 #include <future> 25 #include <atomic> 26 #include <memory> 27 #include <cassert> 28 29 #include "test_macros.h" 30 31 int foo (int x) { return x; } 32 33 int main(int, char**) 34 { 35 std::async( foo, 3); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} 36 std::async(std::launch::async, foo, 3); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} 37 38 return 0; 39 } 40