1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: no-threads
16 // future<R> get_future();
21 #include "test_macros.h"
26 std::promise
<double> p
;
27 std::future
<double> f
= p
.get_future();
29 assert(f
.get() == 105.5);
31 #ifndef TEST_HAS_NO_EXCEPTIONS
33 std::promise
<double> p
;
34 std::future
<double> f
= p
.get_future();
40 catch (const std::future_error
& e
)
42 assert(e
.code() == make_error_code(std::future_errc::future_already_retrieved
));
46 std::promise
<double> p
;
47 std::promise
<double> p0
= std::move(p
);
50 std::future
<double> f
= p
.get_future();
53 catch (const std::future_error
& e
)
55 assert(e
.code() == make_error_code(std::future_errc::no_state
));