blob: 10501ac68f1fc3b98950a47959cb8b4d70eb8c97 [file] [log] [blame]
Howard Hinnant7158e5c2010-08-29 14:20:30 +00001//===----------------------------------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <future>
11
12// class future<R>
13
14// future(future&& rhs);
15
16#include <future>
17#include <cassert>
18
19int main()
20{
Howard Hinnant73d21a42010-09-04 23:28:19 +000021#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant7158e5c2010-08-29 14:20:30 +000022 {
23 typedef int T;
24 std::promise<T> p;
25 std::future<T> f0 = p.get_future();
26 std::future<T> f = std::move(f0);
27 assert(!f0.valid());
28 assert(f.valid());
29 }
30 {
31 typedef int T;
32 std::future<T> f0;
33 std::future<T> f = std::move(f0);
34 assert(!f0.valid());
35 assert(!f.valid());
36 }
37 {
38 typedef int& T;
39 std::promise<T> p;
40 std::future<T> f0 = p.get_future();
41 std::future<T> f = std::move(f0);
42 assert(!f0.valid());
43 assert(f.valid());
44 }
45 {
46 typedef int& T;
47 std::future<T> f0;
48 std::future<T> f = std::move(f0);
49 assert(!f0.valid());
50 assert(!f.valid());
51 }
52 {
53 typedef void T;
54 std::promise<T> p;
55 std::future<T> f0 = p.get_future();
56 std::future<T> f = std::move(f0);
57 assert(!f0.valid());
58 assert(f.valid());
59 }
60 {
61 typedef void T;
62 std::future<T> f0;
63 std::future<T> f = std::move(f0);
64 assert(!f0.valid());
65 assert(!f.valid());
66 }
Howard Hinnant73d21a42010-09-04 23:28:19 +000067#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant7158e5c2010-08-29 14:20:30 +000068}