Make futures.overview enum tests more portable. Patch from STL@microsoft.com

llvm-svn: 274211
This commit is contained in:
Eric Fiselier 2016-06-30 05:00:32 +00:00
parent b21f96ac4b
commit d3c2acd38c
2 changed files with 16 additions and 9 deletions

View File

@ -13,18 +13,25 @@
// enum class future_errc
// {
// future_already_retrieved = 1,
// promise_already_satisfied,
// no_state
// broken_promise,
// broken_promise = implementation-defined,
// future_already_retrieved = implementation-defined,
// promise_already_satisfied = implementation-defined,
// no_state = implementation-defined
// };
#include <future>
int main()
{
static_assert(static_cast<int>(std::future_errc::future_already_retrieved) == 1, "");
static_assert(static_cast<int>(std::future_errc::promise_already_satisfied) == 2, "");
static_assert(static_cast<int>(std::future_errc::no_state) == 3, "");
static_assert(static_cast<int>(std::future_errc::broken_promise) == 4, "");
static_assert(std::future_errc::broken_promise != std::future_errc::future_already_retrieved, "");
static_assert(std::future_errc::broken_promise != std::future_errc::promise_already_satisfied, "");
static_assert(std::future_errc::broken_promise != std::future_errc::no_state, "");
static_assert(std::future_errc::future_already_retrieved != std::future_errc::promise_already_satisfied, "");
static_assert(std::future_errc::future_already_retrieved != std::future_errc::no_state, "");
static_assert(std::future_errc::promise_already_satisfied != std::future_errc::no_state, "");
static_assert(std::future_errc::broken_promise != static_cast<std::future_errc>(0), "");
static_assert(std::future_errc::future_already_retrieved != static_cast<std::future_errc>(0), "");
static_assert(std::future_errc::promise_already_satisfied != static_cast<std::future_errc>(0), "");
static_assert(std::future_errc::no_state != static_cast<std::future_errc>(0), "");
}

View File

@ -32,7 +32,7 @@ int main()
LIBCPP_STATIC_ASSERT(std::launch::any == (std::launch::async | std::launch::deferred), "");
static_assert(std::launch(0) == (std::launch::async & std::launch::deferred), "");
LIBCPP_STATIC_ASSERT(std::launch::any == (std::launch::async ^ std::launch::deferred), "");
static_assert(std::launch::deferred == ~std::launch::async, "");
LIBCPP_STATIC_ASSERT(std::launch::deferred == ~std::launch::async, "");
std::launch x = std::launch::async;
x &= std::launch::deferred;
assert(x == std::launch(0));