• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // Copyright (C) 2011 Vicente J. Botet Escriba
11 //
12 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
13 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
14 
15 // <future>
16 
17 // class future<R>
18 
19 // future& operator=(future&& rhs);
20 
21 #define BOOST_THREAD_VERSION 3
22 
23 #include <boost/thread/future.hpp>
24 #include <boost/detail/lightweight_test.hpp>
25 
26 boost::mutex m0;
27 boost::mutex m1;
28 
main()29 int main()
30 {
31   {
32       typedef int T;
33       boost::promise<T> p;
34       boost::future<T> f0 = BOOST_THREAD_MAKE_RV_REF(p.get_future());
35       boost::future<T> f;
36       f = boost::move(f0);
37       BOOST_TEST(!f0.valid());
38       BOOST_TEST(f.valid());
39   }
40   {
41       typedef int T;
42       boost::future<T> f0;
43       boost::future<T> f;
44       f = boost::move(f0);
45       BOOST_TEST(!f0.valid());
46       BOOST_TEST(!f.valid());
47   }
48   {
49       typedef int& T;
50       boost::promise<T> p;
51       boost::future<T> f0 = BOOST_THREAD_MAKE_RV_REF(p.get_future());
52       boost::future<T> f;
53       f = boost::move(f0);
54       BOOST_TEST(!f0.valid());
55       BOOST_TEST(f.valid());
56   }
57   {
58       typedef int& T;
59       boost::future<T> f0;
60       boost::future<T> f;
61       f = boost::move(f0);
62       BOOST_TEST(!f0.valid());
63       BOOST_TEST(!f.valid());
64   }
65   {
66       typedef void T;
67       boost::promise<T> p;
68       boost::future<T> f0 = BOOST_THREAD_MAKE_RV_REF(p.get_future());
69       boost::future<T> f;
70       f = boost::move(f0);
71       BOOST_TEST(!f0.valid());
72       BOOST_TEST(f.valid());
73   }
74   {
75       typedef void T;
76       boost::future<T> f0;
77       boost::future<T> f;
78       f = boost::move(f0);
79       BOOST_TEST(!f0.valid());
80       BOOST_TEST(!f.valid());
81   }
82 
83 
84   return boost::report_errors();
85 
86 }
87 
88