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 shared_future<R> 13 14 // shared_future& operator=(shared_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::shared_future<T> f0 = p.get_future(); 26 std::shared_future<T> f; 27 f = std::move(f0); 28 assert(!f0.valid()); 29 assert(f.valid()); 30 } 31 { 32 typedef int T; 33 std::shared_future<T> f0; 34 std::shared_future<T> f; 35 f = std::move(f0); 36 assert(!f0.valid()); 37 assert(!f.valid()); 38 } 39 { 40 typedef int& T; 41 std::promise<T> p; 42 std::shared_future<T> f0 = p.get_future(); 43 std::shared_future<T> f; 44 f = std::move(f0); 45 assert(!f0.valid()); 46 assert(f.valid()); 47 } 48 { 49 typedef int& T; 50 std::shared_future<T> f0; 51 std::shared_future<T> f; 52 f = std::move(f0); 53 assert(!f0.valid()); 54 assert(!f.valid()); 55 } 56 { 57 typedef void T; 58 std::promise<T> p; 59 std::shared_future<T> f0 = p.get_future(); 60 std::shared_future<T> f; 61 f = std::move(f0); 62 assert(!f0.valid()); 63 assert(f.valid()); 64 } 65 { 66 typedef void T; 67 std::shared_future<T> f0; 68 std::shared_future<T> f; 69 f = std::move(f0); 70 assert(!f0.valid()); 71 assert(!f.valid()); 72 } 73 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 74 } 75