1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // UNSUPPORTED: libcpp-has-no-threads 10 11 // <future> 12 13 // enum class launch 14 // { 15 // async = 1, 16 // deferred = 2, 17 // any = async | deferred /* EXTENSION */ 18 // }; 19 20 #include <future> 21 #include <cassert> 22 23 #include "test_macros.h" 24 25 int main(int, char**) 26 { 27 #if TEST_STD_VER < 11 28 LIBCPP_STATIC_ASSERT(static_cast<int>(std::launch::any) == 29 (static_cast<int>(std::launch::async) | static_cast<int>(std::launch::deferred)), ""); 30 #else 31 LIBCPP_STATIC_ASSERT(std::launch::any == (std::launch::async | std::launch::deferred), ""); 32 static_assert(std::launch(0) == (std::launch::async & std::launch::deferred), ""); 33 LIBCPP_STATIC_ASSERT(std::launch::any == (std::launch::async ^ std::launch::deferred), ""); 34 LIBCPP_STATIC_ASSERT(std::launch::deferred == ~std::launch::async, ""); 35 std::launch x = std::launch::async; 36 x &= std::launch::deferred; 37 assert(x == std::launch(0)); 38 x = std::launch::async; 39 x |= std::launch::deferred; 40 LIBCPP_ASSERT(x == std::launch::any); 41 x ^= std::launch::deferred; 42 assert(x == std::launch::async); 43 #endif 44 static_assert(static_cast<int>(std::launch::async) == 1, ""); 45 static_assert(static_cast<int>(std::launch::deferred) == 2, ""); 46 47 return 0; 48 } 49