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
10 // UNSUPPORTED: c++03, c++11, c++14
16 // explicit future_error(future_errc e); // since C++17
20 #include <type_traits>
22 int main(int, char**) {
24 std::future_error
f(std::future_errc::broken_promise
);
25 assert(f
.code() == std::make_error_code(std::future_errc::broken_promise
));
28 std::future_error
f(std::future_errc::future_already_retrieved
);
29 assert(f
.code() == std::make_error_code(std::future_errc::future_already_retrieved
));
32 std::future_error
f(std::future_errc::promise_already_satisfied
);
33 assert(f
.code() == std::make_error_code(std::future_errc::promise_already_satisfied
));
36 std::future_error
f(std::future_errc::no_state
);
37 assert(f
.code() == std::make_error_code(std::future_errc::no_state
));
40 // Make sure the constructor is explicit
41 static_assert(!std::is_convertible_v
<std::future_errc
, std::future_error
>);