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 // <future> 11 12 // enum class launch 13 // { 14 // async = 1, 15 // deferred = 2, 16 // any = async | deferred 17 // }; 18 19 #include <future> 20 #include <cassert> 21 main()22int main() 23 { 24 #ifdef _LIBCPP_HAS_NO_STRONG_ENUMS 25 static_assert(static_cast<int>(std::launch::any) == 26 (static_cast<int>(std::launch::async) | static_cast<int>(std::launch::deferred)), ""); 27 #else 28 static_assert(std::launch::any == (std::launch::async | std::launch::deferred), ""); 29 static_assert(std::launch(0) == (std::launch::async & std::launch::deferred), ""); 30 static_assert(std::launch::any == (std::launch::async ^ std::launch::deferred), ""); 31 static_assert(std::launch::deferred == ~std::launch::async, ""); 32 std::launch x = std::launch::async; 33 x &= std::launch::deferred; 34 assert(x == std::launch(0)); 35 x = std::launch::async; 36 x |= std::launch::deferred; 37 assert(x == std::launch::any); 38 x ^= std::launch::deferred; 39 assert(x == std::launch::async); 40 #endif 41 static_assert(static_cast<int>(std::launch::async) == 1, ""); 42 static_assert(static_cast<int>(std::launch::deferred) == 2, ""); 43 } 44