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