15a83710eSEric Fiselier //===----------------------------------------------------------------------===// 25a83710eSEric Fiselier // 357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 65a83710eSEric Fiselier // 75a83710eSEric Fiselier //===----------------------------------------------------------------------===// 85a83710eSEric Fiselier // 9*a7f9895cSLouis Dionne // UNSUPPORTED: no-threads 105a83710eSEric Fiselier 115a83710eSEric Fiselier // <future> 125a83710eSEric Fiselier 135a83710eSEric Fiselier // class future_error 1487f2f168SMarshall Clow // future_error(error_code __ec); // exposition only 1587f2f168SMarshall Clow // explicit future_error(future_errc _Ev) : __ec_(make_error_code(_Ev)) {} // C++17 165a83710eSEric Fiselier 175a83710eSEric Fiselier // const error_code& code() const throw(); 185a83710eSEric Fiselier 195a83710eSEric Fiselier #include <future> 205a83710eSEric Fiselier #include <cassert> 215a83710eSEric Fiselier 2287f2f168SMarshall Clow #include "test_macros.h" 2387f2f168SMarshall Clow main(int,char **)242df59c50SJF Bastienint main(int, char**) 255a83710eSEric Fiselier { 265a83710eSEric Fiselier { 275a83710eSEric Fiselier std::error_code ec = std::make_error_code(std::future_errc::broken_promise); 285a83710eSEric Fiselier std::future_error f(ec); 295a83710eSEric Fiselier assert(f.code() == ec); 305a83710eSEric Fiselier } 315a83710eSEric Fiselier { 325a83710eSEric Fiselier std::error_code ec = std::make_error_code(std::future_errc::future_already_retrieved); 335a83710eSEric Fiselier std::future_error f(ec); 345a83710eSEric Fiselier assert(f.code() == ec); 355a83710eSEric Fiselier } 365a83710eSEric Fiselier { 375a83710eSEric Fiselier std::error_code ec = std::make_error_code(std::future_errc::promise_already_satisfied); 385a83710eSEric Fiselier std::future_error f(ec); 395a83710eSEric Fiselier assert(f.code() == ec); 405a83710eSEric Fiselier } 415a83710eSEric Fiselier { 425a83710eSEric Fiselier std::error_code ec = std::make_error_code(std::future_errc::no_state); 435a83710eSEric Fiselier std::future_error f(ec); 445a83710eSEric Fiselier assert(f.code() == ec); 455a83710eSEric Fiselier } 4687f2f168SMarshall Clow #if TEST_STD_VER > 14 4787f2f168SMarshall Clow { 4887f2f168SMarshall Clow std::future_error f(std::future_errc::broken_promise); 4987f2f168SMarshall Clow assert(f.code() == std::make_error_code(std::future_errc::broken_promise)); 5087f2f168SMarshall Clow } 5187f2f168SMarshall Clow { 5287f2f168SMarshall Clow std::future_error f(std::future_errc::no_state); 5387f2f168SMarshall Clow assert(f.code() == std::make_error_code(std::future_errc::no_state)); 5487f2f168SMarshall Clow } 5587f2f168SMarshall Clow #endif 562df59c50SJF Bastien 572df59c50SJF Bastien return 0; 585a83710eSEric Fiselier } 59