ELF: Have __rela_iplt_{start,end} surround .rela.iplt with --pack-dyn-relocs=android.
[llvm-project.git] / libcxx / test / std / thread / futures / futures.shared_future / move_assign.pass.cpp
blobcc3f3f85a84c2d08dbc46f66a9083a6319e9fb7e
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& operator=(shared_future&& 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::shared_future<T> f0 = p.get_future();
29 std::shared_future<T> f;
30 f = std::move(f0);
31 assert(!f0.valid());
32 assert(f.valid());
35 typedef int T;
36 std::shared_future<T> f0;
37 std::shared_future<T> f;
38 f = std::move(f0);
39 assert(!f0.valid());
40 assert(!f.valid());
43 typedef int& T;
44 std::promise<T> p;
45 std::shared_future<T> f0 = p.get_future();
46 std::shared_future<T> f;
47 f = std::move(f0);
48 assert(!f0.valid());
49 assert(f.valid());
52 typedef int& T;
53 std::shared_future<T> f0;
54 std::shared_future<T> f;
55 f = std::move(f0);
56 assert(!f0.valid());
57 assert(!f.valid());
60 typedef void T;
61 std::promise<T> p;
62 std::shared_future<T> f0 = p.get_future();
63 std::shared_future<T> f;
64 f = std::move(f0);
65 assert(!f0.valid());
66 assert(f.valid());
69 typedef void T;
70 std::shared_future<T> f0;
71 std::shared_future<T> f;
72 f = std::move(f0);
73 assert(!f0.valid());
74 assert(!f.valid());
77 return 0;