Marshall Clow | b6ad844 | 2017-11-23 01:25:03 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
Chandler Carruth | 57b08b0 | 2019-01-19 10:56:40 +0000 | [diff] [blame] | 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 |
Marshall Clow | b6ad844 | 2017-11-23 01:25:03 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // UNSUPPORTED: libcpp-has-no-threads |
Marshall Clow | 69b903e | 2017-11-23 05:43:25 +0000 | [diff] [blame] | 10 | // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 |
| 11 | // UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8 |
Louis Dionne | aec82f9 | 2020-03-16 14:58:31 -0400 | [diff] [blame^] | 12 | // REQUIRES: verify-support |
Marshall Clow | b6ad844 | 2017-11-23 01:25:03 +0000 | [diff] [blame] | 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 | |
JF Bastien | 2df59c5 | 2019-02-04 20:31:13 +0000 | [diff] [blame] | 34 | int main(int, char**) |
Marshall Clow | b6ad844 | 2017-11-23 01:25:03 +0000 | [diff] [blame] | 35 | { |
Stephan T. Lavavej | ad9545e | 2018-04-12 23:56:22 +0000 | [diff] [blame] | 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}} |
JF Bastien | 2df59c5 | 2019-02-04 20:31:13 +0000 | [diff] [blame] | 38 | |
Louis Dionne | aec82f9 | 2020-03-16 14:58:31 -0400 | [diff] [blame^] | 39 | return 0; |
Stephan T. Lavavej | ad9545e | 2018-04-12 23:56:22 +0000 | [diff] [blame] | 40 | } |