1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <future>
11 
12 // class future<R>
13 
14 // future& operator=(const future&) = delete;
15 
16 #include <future>
17 #include <cassert>
18 
main()19 int main()
20 {
21 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
22     {
23         typedef int T;
24         std::promise<T> p;
25         std::future<T> f0 = p.get_future();
26         std::future<T> f;
27         f = f0;
28         assert(!f0.valid());
29         assert(f.valid());
30     }
31     {
32         typedef int T;
33         std::future<T> f0;
34         std::future<T> f;
35         f = f0;
36         assert(!f0.valid());
37         assert(!f.valid());
38     }
39     {
40         typedef int& T;
41         std::promise<T> p;
42         std::future<T> f0 = p.get_future();
43         std::future<T> f;
44         f = f0;
45         assert(!f0.valid());
46         assert(f.valid());
47     }
48     {
49         typedef int& T;
50         std::future<T> f0;
51         std::future<T> f;
52         f = f0;
53         assert(!f0.valid());
54         assert(!f.valid());
55     }
56     {
57         typedef void T;
58         std::promise<T> p;
59         std::future<T> f0 = p.get_future();
60         std::future<T> f;
61         f = f0;
62         assert(!f0.valid());
63         assert(f.valid());
64     }
65     {
66         typedef void T;
67         std::future<T> f0;
68         std::future<T> f;
69         f = f0;
70         assert(!f0.valid());
71         assert(!f.valid());
72     }
73 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
74 }
75