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 // class future_error 15 // future_error(error_code __ec); // exposition only 16 // explicit future_error(future_errc _Ev) : __ec_(make_error_code(_Ev)) {} // C++17 17 18 // const error_code& code() const throw(); 19 20 #include <future> 21 #include <cassert> 22 23 #include "test_macros.h" 24 main()25int main() 26 { 27 { 28 std::error_code ec = std::make_error_code(std::future_errc::broken_promise); 29 std::future_error f(ec); 30 assert(f.code() == ec); 31 } 32 { 33 std::error_code ec = std::make_error_code(std::future_errc::future_already_retrieved); 34 std::future_error f(ec); 35 assert(f.code() == ec); 36 } 37 { 38 std::error_code ec = std::make_error_code(std::future_errc::promise_already_satisfied); 39 std::future_error f(ec); 40 assert(f.code() == ec); 41 } 42 { 43 std::error_code ec = std::make_error_code(std::future_errc::no_state); 44 std::future_error f(ec); 45 assert(f.code() == ec); 46 } 47 #if TEST_STD_VER > 14 48 { 49 std::future_error f(std::future_errc::broken_promise); 50 assert(f.code() == std::make_error_code(std::future_errc::broken_promise)); 51 } 52 { 53 std::future_error f(std::future_errc::no_state); 54 assert(f.code() == std::make_error_code(std::future_errc::no_state)); 55 } 56 #endif 57 } 58