From: Marshall Clow Date: Mon, 14 Nov 2016 18:56:24 +0000 (+0000) Subject: Implement P0510 'Make future_error Constructible' adopted in Issaquah X-Git-Tag: llvmorg-4.0.0-rc1~4635 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=87f2f1687ef380a96226a10fb189ab65f80ca63f;p=platform%2Fupstream%2Fllvm.git Implement P0510 'Make future_error Constructible' adopted in Issaquah llvm-svn: 286864 --- diff --git a/libcxx/include/future b/libcxx/include/future index 25e958c..656f9c7 100644 --- a/libcxx/include/future +++ b/libcxx/include/future @@ -50,7 +50,7 @@ class future_error { public: future_error(error_code ec); // exposition only - + explicit future_error(future_errc); // C++17 const error_code& code() const noexcept; const char* what() const noexcept; }; @@ -505,7 +505,9 @@ class _LIBCPP_EXCEPTION_ABI future_error error_code __ec_; public: future_error(error_code __ec); - +#if _LIBCPP_STD_VERS > 14 + explicit future_error(future_errc _Ev) : logic_error(), __ec_(make_error_code(_Ev)) {} +#endif _LIBCPP_INLINE_VISIBILITY const error_code& code() const _NOEXCEPT {return __ec_;} diff --git a/libcxx/test/std/thread/futures/futures.future_error/code.pass.cpp b/libcxx/test/std/thread/futures/futures.future_error/code.pass.cpp index e02af48..35d44df 100644 --- a/libcxx/test/std/thread/futures/futures.future_error/code.pass.cpp +++ b/libcxx/test/std/thread/futures/futures.future_error/code.pass.cpp @@ -12,12 +12,16 @@ // // class future_error +// future_error(error_code __ec); // exposition only +// explicit future_error(future_errc _Ev) : __ec_(make_error_code(_Ev)) {} // C++17 // const error_code& code() const throw(); #include #include +#include "test_macros.h" + int main() { { @@ -40,4 +44,14 @@ int main() std::future_error f(ec); assert(f.code() == ec); } +#if TEST_STD_VER > 14 + { + std::future_error f(std::future_errc::broken_promise); + assert(f.code() == std::make_error_code(std::future_errc::broken_promise)); + } + { + std::future_error f(std::future_errc::no_state); + assert(f.code() == std::make_error_code(std::future_errc::no_state)); + } +#endif } diff --git a/libcxx/www/cxx1z_status.html b/libcxx/www/cxx1z_status.html index f8e90bb..f08127c 100644 --- a/libcxx/www/cxx1z_status.html +++ b/libcxx/www/cxx1z_status.html @@ -138,7 +138,7 @@ P0510R0LWGDisallowing references, incomplete types, arrays, and empty variantsIssaquah P0513R0LWGPoisoning the HashIssaquah P0516R0LWGClarify That shared_future’s Copy Operations have Wide ContractsIssaquah - P0517R0LWGMake future_error ConstructibleIssaquah + P0517R0LWGMake future_error ConstructibleIssaquahComplete4.0 P0521R0LWGProposed Resolution for CA 14 (shared_ptr use_count/unique)Issaquah