1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // UNSUPPORTED: libcpp-has-no-threads 11 12 // <future> 13 14 // enum class launch 15 // { 16 // async = 1, 17 // deferred = 2, 18 // any = async | deferred 19 // }; 20 21 #include <future> 22 #include <cassert> 23 main()24int main() 25 { 26 #ifdef _LIBCPP_HAS_NO_STRONG_ENUMS 27 static_assert(static_cast<int>(std::launch::any) == 28 (static_cast<int>(std::launch::async) | static_cast<int>(std::launch::deferred)), ""); 29 #else 30 static_assert(std::launch::any == (std::launch::async | std::launch::deferred), ""); 31 static_assert(std::launch(0) == (std::launch::async & std::launch::deferred), ""); 32 static_assert(std::launch::any == (std::launch::async ^ std::launch::deferred), ""); 33 static_assert(std::launch::deferred == ~std::launch::async, ""); 34 std::launch x = std::launch::async; 35 x &= std::launch::deferred; 36 assert(x == std::launch(0)); 37 x = std::launch::async; 38 x |= std::launch::deferred; 39 assert(x == std::launch::any); 40 x ^= std::launch::deferred; 41 assert(x == std::launch::async); 42 #endif 43 static_assert(static_cast<int>(std::launch::async) == 1, ""); 44 static_assert(static_cast<int>(std::launch::deferred) == 2, ""); 45 } 46