[libc++] Remove duplicated _LIBCPP_HIDE_FROM_ABI from a few declarations (#122323)
[llvm-project.git] / libcxx / test / std / thread / futures / futures.future_error / ctor.pass.cpp
blobbce34105a50922baf9fa1cc137c5068a68a9394d
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: no-threads
10 // UNSUPPORTED: c++03, c++11, c++14
12 // <future>
14 // class future_error
16 // explicit future_error(future_errc e); // since C++17
18 #include <cassert>
19 #include <future>
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>);
43 return 0;