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: libcpp-has-no-threads
14 // future_error(error_code __ec); // exposition only
15 // explicit future_error(future_errc _Ev) : __ec_(make_error_code(_Ev)) {} // C++17
17 // const error_code& code() const throw();
22 #include "test_macros.h"
27 std::error_code ec
= std::make_error_code(std::future_errc::broken_promise
);
28 std::future_error
f(ec
);
29 assert(f
.code() == ec
);
32 std::error_code ec
= std::make_error_code(std::future_errc::future_already_retrieved
);
33 std::future_error
f(ec
);
34 assert(f
.code() == ec
);
37 std::error_code ec
= std::make_error_code(std::future_errc::promise_already_satisfied
);
38 std::future_error
f(ec
);
39 assert(f
.code() == ec
);
42 std::error_code ec
= std::make_error_code(std::future_errc::no_state
);
43 std::future_error
f(ec
);
44 assert(f
.code() == ec
);
48 std::future_error
f(std::future_errc::broken_promise
);
49 assert(f
.code() == std::make_error_code(std::future_errc::broken_promise
));
52 std::future_error
f(std::future_errc::no_state
);
53 assert(f
.code() == std::make_error_code(std::future_errc::no_state
));