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
21 #include "test_macros.h"
35 #ifndef TEST_HAS_NO_EXCEPTIONS
46 ((void)i
); // Prevent unused warning
49 catch (const std::future_error
& e
)
51 assert(e
.code() == make_error_code(std::future_errc::broken_promise
));
65 assert(&f
.get() == &i
);
67 #ifndef TEST_HAS_NO_EXCEPTIONS
78 ((void)i
); // Prevent unused warning
81 catch (const std::future_error
& e
)
83 assert(e
.code() == make_error_code(std::future_errc::broken_promise
));
99 #ifndef TEST_HAS_NO_EXCEPTIONS
112 catch (const std::future_error
& e
)
114 // LWG 2056 changed the values of future_errc, so if we're using new
115 // headers with an old library the error codes won't line up.
117 // Note that this particular check only applies to promise<void>
118 // since the other specializations happen to be implemented in the
119 // header rather than the library.
121 e
.code() == make_error_code(std::future_errc::broken_promise
) ||
122 e
.code() == std::error_code(0, std::future_category()));