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// UNSUPPORTED: libcpp-has-no-threads
11
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{
23#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
24    {
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    }
75#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
76}
77