[libc++][NFC] Add missing includes in tzdb.cpp
[llvm-project.git] / libcxx / test / std / thread / futures / futures.unique_future / move_assign.pass.cpp
blob0378e8719d4ee2b760e792a4c9830293ff45b4b0
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, c++03
11 // <future>
13 // class future<R>
15 // future& operator=(future&& rhs);
17 #include <future>
18 #include <cassert>
20 #include "test_macros.h"
22 int main(int, char**)
25 typedef int T;
26 std::promise<T> p;
27 std::future<T> f0 = p.get_future();
28 std::future<T> f;
29 f = std::move(f0);
30 assert(!f0.valid());
31 assert(f.valid());
34 typedef int T;
35 std::future<T> f0;
36 std::future<T> f;
37 f = std::move(f0);
38 assert(!f0.valid());
39 assert(!f.valid());
42 typedef int& T;
43 std::promise<T> p;
44 std::future<T> f0 = p.get_future();
45 std::future<T> f;
46 f = std::move(f0);
47 assert(!f0.valid());
48 assert(f.valid());
51 typedef int& T;
52 std::future<T> f0;
53 std::future<T> f;
54 f = std::move(f0);
55 assert(!f0.valid());
56 assert(!f.valid());
59 typedef void T;
60 std::promise<T> p;
61 std::future<T> f0 = p.get_future();
62 std::future<T> f;
63 f = std::move(f0);
64 assert(!f0.valid());
65 assert(f.valid());
68 typedef void T;
69 std::future<T> f0;
70 std::future<T> f;
71 f = std::move(f0);
72 assert(!f0.valid());
73 assert(!f.valid());
76 return 0;