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 16 // const error_code& code() const throw(); 17 18 #include <future> 19 #include <cassert> 20 21 int main() 22 { 23 { 24 std::error_code ec = std::make_error_code(std::future_errc::broken_promise); 25 std::future_error f(ec); 26 assert(f.code() == ec); 27 } 28 { 29 std::error_code ec = std::make_error_code(std::future_errc::future_already_retrieved); 30 std::future_error f(ec); 31 assert(f.code() == ec); 32 } 33 { 34 std::error_code ec = std::make_error_code(std::future_errc::promise_already_satisfied); 35 std::future_error f(ec); 36 assert(f.code() == ec); 37 } 38 { 39 std::error_code ec = std::make_error_code(std::future_errc::no_state); 40 std::future_error f(ec); 41 assert(f.code() == ec); 42 } 43 } 44