1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // UNSUPPORTED: libcpp-has-no-threads 11 // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 12 // UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 13 14 // <future> 15 16 // template <class F, class... Args> 17 // future<typename result_of<F(Args...)>::type> 18 // async(F&& f, Args&&... args); 19 20 // template <class F, class... Args> 21 // future<typename result_of<F(Args...)>::type> 22 // async(launch policy, F&& f, Args&&... args); 23 24 25 #include <future> 26 #include <atomic> 27 #include <memory> 28 #include <cassert> 29 30 #include "test_macros.h" 31 32 int foo (int x) { return x; } 33 34 int main () 35 { 36 std::async( foo, 3); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} 37 std::async(std::launch::async, foo, 3); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} 38 }