[libcxx] r274211 - Make futures.overview enum tests more portable. Patch from STL at microsoft.com

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 29 22:00:33 PDT 2016


Author: ericwf
Date: Thu Jun 30 00:00:32 2016
New Revision: 274211

URL: http://llvm.org/viewvc/llvm-project?rev=274211&view=rev
Log:
Make futures.overview enum tests more portable. Patch from STL at microsoft.com

Modified:
    libcxx/trunk/test/std/thread/futures/futures.overview/future_errc.pass.cpp
    libcxx/trunk/test/std/thread/futures/futures.overview/launch.pass.cpp

Modified: libcxx/trunk/test/std/thread/futures/futures.overview/future_errc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/futures/futures.overview/future_errc.pass.cpp?rev=274211&r1=274210&r2=274211&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/futures/futures.overview/future_errc.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/futures/futures.overview/future_errc.pass.cpp Thu Jun 30 00:00:32 2016
@@ -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), "");
 }

Modified: libcxx/trunk/test/std/thread/futures/futures.overview/launch.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/futures/futures.overview/launch.pass.cpp?rev=274211&r1=274210&r2=274211&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/futures/futures.overview/launch.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/futures/futures.overview/launch.pass.cpp Thu Jun 30 00:00:32 2016
@@ -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));




More information about the cfe-commits mailing list