[rtsan] Add fork/execve interceptors (#117198)
[llvm-project.git] / libcxx / test / std / thread / futures / futures.shared_future / ctor_future.pass.cpp
blobf120fa03b9e66dedf38baefd356e2c81d98e3263
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
12 // <future>
14 // class shared_future<R>
16 // shared_future(future<R>&& rhs);
18 #include <future>
19 #include <cassert>
21 #include "test_macros.h"
23 int main(int, char**)
26 typedef int T;
27 std::promise<T> p;
28 std::future<T> f0 = p.get_future();
29 std::shared_future<T> f = std::move(f0);
30 assert(!f0.valid());
31 assert(f.valid());
34 typedef int T;
35 std::future<T> f0;
36 std::shared_future<T> f = std::move(f0);
37 assert(!f0.valid());
38 assert(!f.valid());
41 typedef int& T;
42 std::promise<T> p;
43 std::future<T> f0 = p.get_future();
44 std::shared_future<T> f = std::move(f0);
45 assert(!f0.valid());
46 assert(f.valid());
49 typedef int& T;
50 std::future<T> f0;
51 std::shared_future<T> f = std::move(f0);
52 assert(!f0.valid());
53 assert(!f.valid());
56 typedef void T;
57 std::promise<T> p;
58 std::future<T> f0 = p.get_future();
59 std::shared_future<T> f = std::move(f0);
60 assert(!f0.valid());
61 assert(f.valid());
64 typedef void T;
65 std::future<T> f0;
66 std::shared_future<T> f = std::move(f0);
67 assert(!f0.valid());
68 assert(!f.valid());
71 return 0;