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 //===----------------------------------------------------------------------===//
10 // UNSUPPORTED: no-threads, no-exceptions
16 // void promise::set_value(R&& r);
22 #include "test_macros.h"
34 typedef std::unique_ptr
<int> T
;
37 std::future
<T
> f
= p
.get_future();
38 p
.set_value(std::move(i
));
39 assert(*f
.get() == 3);
42 p
.set_value(std::move(i
));
45 catch (const std::future_error
& e
)
47 assert(e
.code() == make_error_code(std::future_errc::promise_already_satisfied
));
54 std::future
<T
> f
= p
.get_future();
57 p
.set_value(std::move(i
));