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 // <future> 11 12 // class future<R> 13 14 // future(future&& rhs); 15 16 #include <future> 17 #include <cassert> 18 main()19int main() 20 { 21 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 22 { 23 typedef int T; 24 std::promise<T> p; 25 std::future<T> f0 = p.get_future(); 26 std::future<T> f = std::move(f0); 27 assert(!f0.valid()); 28 assert(f.valid()); 29 } 30 { 31 typedef int T; 32 std::future<T> f0; 33 std::future<T> f = std::move(f0); 34 assert(!f0.valid()); 35 assert(!f.valid()); 36 } 37 { 38 typedef int& T; 39 std::promise<T> p; 40 std::future<T> f0 = p.get_future(); 41 std::future<T> f = std::move(f0); 42 assert(!f0.valid()); 43 assert(f.valid()); 44 } 45 { 46 typedef int& T; 47 std::future<T> f0; 48 std::future<T> f = std::move(f0); 49 assert(!f0.valid()); 50 assert(!f.valid()); 51 } 52 { 53 typedef void T; 54 std::promise<T> p; 55 std::future<T> f0 = p.get_future(); 56 std::future<T> f = std::move(f0); 57 assert(!f0.valid()); 58 assert(f.valid()); 59 } 60 { 61 typedef void T; 62 std::future<T> f0; 63 std::future<T> f = std::move(f0); 64 assert(!f0.valid()); 65 assert(!f.valid()); 66 } 67 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 68 } 69