1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // UNSUPPORTED: libcpp-has-no-threads
11 // UNSUPPORTED: c++98, c++03
17 // future<R> get_future();
22 #include "test_macros.h"
27 std::promise<double> p;
28 std::future<double> f = p.get_future();
30 assert(f.get() == 105.5);
32 #ifndef TEST_HAS_NO_EXCEPTIONS
34 std::promise<double> p;
35 std::future<double> f = p.get_future();
41 catch (const std::future_error& e)
43 assert(e.code() == make_error_code(std::future_errc::future_already_retrieved));
47 std::promise<double> p;
48 std::promise<double> p0 = std::move(p);
51 std::future<double> f = p.get_future();
54 catch (const std::future_error& e)
56 assert(e.code() == make_error_code(std::future_errc::no_state));