blob: 6c0bbd4716f160003fe0007e9ac78bea89a2ea60 [file] [log] [blame]
Howard Hinnante6e4d012010-09-03 21:46:37 +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 atomic_future<R>
13
14// atomic_future& operator=(const atomic_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 Hinnante6e4d012010-09-03 21:46:37 +000022 {
23 typedef int T;
24 std::promise<T> p;
25 std::atomic_future<T> f0 = p.get_future();
26 std::atomic_future<T> f;
27 f = f0;
28 assert(f0.valid());
29 assert(f.valid());
30 }
31 {
32 typedef int T;
33 std::atomic_future<T> f0;
34 std::atomic_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::atomic_future<T> f0 = p.get_future();
43 std::atomic_future<T> f;
44 f = f0;
45 assert(f0.valid());
46 assert(f.valid());
47 }
48 {
49 typedef int& T;
50 std::atomic_future<T> f0;
51 std::atomic_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::atomic_future<T> f0 = p.get_future();
60 std::atomic_future<T> f;
61 f = f0;
62 assert(f0.valid());
63 assert(f.valid());
64 }
65 {
66 typedef void T;
67 std::atomic_future<T> f0;
68 std::atomic_future<T> f;
69 f = f0;
70 assert(!f0.valid());
71 assert(!f.valid());
72 }
Howard Hinnant73d21a42010-09-04 23:28:19 +000073#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnante6e4d012010-09-03 21:46:37 +000074}