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: no-threads
10// UNSUPPORTED: c++03
11
12// <future>
13
14// class promise<R>
15
16// promise();
17
18#include <future>
19#include <cassert>
20
21#include "test_macros.h"
22
23int main(int, char**)
24{
25 {
26 std::promise<int> p;
27 std::future<int> f = p.get_future();
28 assert(f.valid());
29 }
30 {
31 std::promise<int&> p;
32 std::future<int&> f = p.get_future();
33 assert(f.valid());
34 }
35 {
36 std::promise<void> p;
37 std::future<void> f = p.get_future();
38 assert(f.valid());
39 }
40
41 return 0;
42}
43

source code of libcxx/test/std/thread/futures/futures.promise/default.pass.cpp