Marshall Clow | b6ad844 | 2017-11-23 01:25:03 +0000 | [diff] [blame^] | 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 |
| 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 () |
| 34 | { |
| 35 | std::async( foo, 3); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} |
| 36 | std::async(std::launch::async, foo, 3); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}} |
| 37 | } |