blob: 176459eb571c3bad1001820d47aed631bc16a510 [file] [log] [blame]
Marshall Clowb6ad8442017-11-23 01:25:03 +00001//===----------------------------------------------------------------------===//
2//
Chandler Carruth57b08b02019-01-19 10:56:40 +00003// 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 Clowb6ad8442017-11-23 01:25:03 +00006//
7//===----------------------------------------------------------------------===//
8//
9// UNSUPPORTED: libcpp-has-no-threads
Louis Dionne31cbe0f2020-06-01 10:38:23 -040010// UNSUPPORTED: c++03, c++11, c++14, c++17
Marshall Clowb6ad8442017-11-23 01:25:03 +000011
12// <future>
13
14// template <class F, class... Args>
15// future<typename result_of<F(Args...)>::type>
16// async(F&& f, Args&&... args);
17
18// template <class F, class... Args>
19// future<typename result_of<F(Args...)>::type>
20// async(launch policy, F&& f, Args&&... args);
21
22
23#include <future>
24#include <atomic>
25#include <memory>
26#include <cassert>
27
28#include "test_macros.h"
29
30int foo (int x) { return x; }
31
JF Bastien2df59c52019-02-04 20:31:13 +000032int main(int, char**)
Marshall Clowb6ad8442017-11-23 01:25:03 +000033{
Louis Dionnea5fa5f72020-03-17 12:27:10 -040034 std::async( foo, 3); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
35 std::async(std::launch::async, foo, 3); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
JF Bastien2df59c52019-02-04 20:31:13 +000036
Louis Dionneaec82f92020-03-16 14:58:31 -040037 return 0;
Stephan T. Lavavejad9545e2018-04-12 23:56:22 +000038}