blob: 32b8fd77c672bffaed6f45384913bbd545c04124 [file] [log] [blame]
Howard Hinnant99be8232010-09-03 18:39:25 +00001//===----------------------------------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnant99be8232010-09-03 18:39:25 +00007//
8//===----------------------------------------------------------------------===//
Jonathan Roelofs8d86b2e2014-09-05 19:45:05 +00009//
10// UNSUPPORTED: libcpp-has-no-threads
Howard Hinnant99be8232010-09-03 18:39:25 +000011
12// <future>
13
14// class shared_future<R>
15
16// shared_future(shared_future&& rhs);
17
18#include <future>
19#include <cassert>
20
21int main()
22{
23 {
24 typedef int T;
25 std::promise<T> p;
26 std::shared_future<T> f0 = p.get_future();
27 std::shared_future<T> f = std::move(f0);
28 assert(!f0.valid());
29 assert(f.valid());
30 }
31 {
32 typedef int T;
33 std::shared_future<T> f0;
34 std::shared_future<T> f = std::move(f0);
35 assert(!f0.valid());
36 assert(!f.valid());
37 }
38 {
39 typedef int& T;
40 std::promise<T> p;
41 std::shared_future<T> f0 = p.get_future();
42 std::shared_future<T> f = std::move(f0);
43 assert(!f0.valid());
44 assert(f.valid());
45 }
46 {
47 typedef int& T;
48 std::shared_future<T> f0;
49 std::shared_future<T> f = std::move(f0);
50 assert(!f0.valid());
51 assert(!f.valid());
52 }
53 {
54 typedef void T;
55 std::promise<T> p;
56 std::shared_future<T> f0 = p.get_future();
57 std::shared_future<T> f = std::move(f0);
58 assert(!f0.valid());
59 assert(f.valid());
60 }
61 {
62 typedef void T;
63 std::shared_future<T> f0;
64 std::shared_future<T> f = std::move(f0);
65 assert(!f0.valid());
66 assert(!f.valid());
67 }
68}