[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / thread / futures / futures.future_error / code.pass.cpp
blob53acba393fb8a6ee036398ebbc6fd498d73d14e1
1 //===----------------------------------------------------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // UNSUPPORTED: libcpp-has-no-threads
11 // <future>
13 // class future_error
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();
19 #include <future>
20 #include <cassert>
22 #include "test_macros.h"
24 int main(int, char**)
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);
46 #if TEST_STD_VER > 14
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));
55 #endif
57 return 0;