xref: /llvm-project/libcxx/test/std/thread/futures/futures.overview/future_errc.pass.cpp (revision a7f9895cc18995549c7facb96e72718da282a864)
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 
11 // UNSUPPORTED: c++03
12 // Libc++'s enum class emulation does not allow static_cast<Enum>(0) to work.
13 
14 // <future>
15 
16 // enum class future_errc
17 // {
18 //     broken_promise = implementation-defined,
19 //     future_already_retrieved = implementation-defined,
20 //     promise_already_satisfied = implementation-defined,
21 //     no_state = implementation-defined
22 // };
23 
24 #include <future>
25 
26 #include "test_macros.h"
27 
main(int,char **)28 int main(int, char**)
29 {
30     static_assert(std::future_errc::broken_promise != std::future_errc::future_already_retrieved, "");
31     static_assert(std::future_errc::broken_promise != std::future_errc::promise_already_satisfied, "");
32     static_assert(std::future_errc::broken_promise != std::future_errc::no_state, "");
33     static_assert(std::future_errc::future_already_retrieved != std::future_errc::promise_already_satisfied, "");
34     static_assert(std::future_errc::future_already_retrieved != std::future_errc::no_state, "");
35     static_assert(std::future_errc::promise_already_satisfied != std::future_errc::no_state, "");
36 
37     static_assert(std::future_errc::broken_promise != static_cast<std::future_errc>(0), "");
38     static_assert(std::future_errc::future_already_retrieved != static_cast<std::future_errc>(0), "");
39     static_assert(std::future_errc::promise_already_satisfied != static_cast<std::future_errc>(0), "");
40     static_assert(std::future_errc::no_state != static_cast<std::future_errc>(0), "");
41 
42   return 0;
43 }
44