[libcxx] r185452 - Constrain launch ~ operator to defined bits.

Howard Hinnant hhinnant at apple.com
Tue Jul 2 11:01:42 PDT 2013


Author: hhinnant
Date: Tue Jul  2 13:01:41 2013
New Revision: 185452

URL: http://llvm.org/viewvc/llvm-project?rev=185452&view=rev
Log:
Constrain launch ~ operator to defined bits.

Modified:
    libcxx/trunk/include/future
    libcxx/trunk/test/thread/futures/futures.overview/launch.pass.cpp

Modified: libcxx/trunk/include/future
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/future?rev=185452&r1=185451&r2=185452&view=diff
==============================================================================
--- libcxx/trunk/include/future (original)
+++ libcxx/trunk/include/future Tue Jul  2 13:01:41 2013
@@ -443,7 +443,7 @@ _LIBCPP_CONSTEXPR
 launch
 operator~(launch __x)
 {
-    return static_cast<launch>(~static_cast<__launch_underlying_type>(__x));
+    return static_cast<launch>(~static_cast<__launch_underlying_type>(__x) & 3);
 }
 
 inline _LIBCPP_INLINE_VISIBILITY

Modified: libcxx/trunk/test/thread/futures/futures.overview/launch.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/futures/futures.overview/launch.pass.cpp?rev=185452&r1=185451&r2=185452&view=diff
==============================================================================
--- libcxx/trunk/test/thread/futures/futures.overview/launch.pass.cpp (original)
+++ libcxx/trunk/test/thread/futures/futures.overview/launch.pass.cpp Tue Jul  2 13:01:41 2013
@@ -28,7 +28,7 @@ int main()
     static_assert(std::launch::any == (std::launch::async | std::launch::deferred), "");
     static_assert(std::launch(0) == (std::launch::async & std::launch::deferred), "");
     static_assert(std::launch::any == (std::launch::async ^ std::launch::deferred), "");
-    static_assert(std::launch(~1) == ~std::launch::async, "");
+    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