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