blob: 6b58f41c90855304fbd885cb4eb046f325a4ddba [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& operator=(shared_future&& rhs);
17
18#include <future>
19#include <cassert>
20
21int main()
22{
Dan Albert1d4a1ed2016-05-25 22:36:09 -070023#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant99be8232010-09-03 18:39:25 +000024 {
25 typedef int T;
26 std::promise<T> p;
27 std::shared_future<T> f0 = p.get_future();
28 std::shared_future<T> f;
29 f = std::move(f0);
30 assert(!f0.valid());
31 assert(f.valid());
32 }
33 {
34 typedef int T;
35 std::shared_future<T> f0;
36 std::shared_future<T> f;
37 f = std::move(f0);
38 assert(!f0.valid());
39 assert(!f.valid());
40 }
41 {
42 typedef int& T;
43 std::promise<T> p;
44 std::shared_future<T> f0 = p.get_future();
45 std::shared_future<T> f;
46 f = std::move(f0);
47 assert(!f0.valid());
48 assert(f.valid());
49 }
50 {
51 typedef int& T;
52 std::shared_future<T> f0;
53 std::shared_future<T> f;
54 f = std::move(f0);
55 assert(!f0.valid());
56 assert(!f.valid());
57 }
58 {
59 typedef void T;
60 std::promise<T> p;
61 std::shared_future<T> f0 = p.get_future();
62 std::shared_future<T> f;
63 f = std::move(f0);
64 assert(!f0.valid());
65 assert(f.valid());
66 }
67 {
68 typedef void T;
69 std::shared_future<T> f0;
70 std::shared_future<T> f;
71 f = std::move(f0);
72 assert(!f0.valid());
73 assert(!f.valid());
74 }
Dan Albert1d4a1ed2016-05-25 22:36:09 -070075#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant99be8232010-09-03 18:39:25 +000076}