diff options
| author | Marshall Clow <mclow.lists@gmail.com> | 2016-11-14 18:56:24 +0000 |
|---|---|---|
| committer | Marshall Clow <mclow.lists@gmail.com> | 2016-11-14 18:56:24 +0000 |
| commit | 87f2f1687ef380a96226a10fb189ab65f80ca63f (patch) | |
| tree | cd58af75c6ae973251d0d29d44e49a2fc4089a2e | |
| parent | a9548937d621d992235dc0a103e06746e7feaccd (diff) | |
| download | bcm5719-llvm-87f2f1687ef380a96226a10fb189ab65f80ca63f.tar.gz bcm5719-llvm-87f2f1687ef380a96226a10fb189ab65f80ca63f.zip | |
Implement P0510 'Make future_error Constructible' adopted in Issaquah
llvm-svn: 286864
| -rw-r--r-- | libcxx/include/future | 6 | ||||
| -rw-r--r-- | libcxx/test/std/thread/futures/futures.future_error/code.pass.cpp | 14 | ||||
| -rw-r--r-- | libcxx/www/cxx1z_status.html | 2 |
3 files changed, 19 insertions, 3 deletions
diff --git a/libcxx/include/future b/libcxx/include/future index 25e958cbf68..656f9c74661 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 e02af486fc3..35d44df5bbb 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 @@ // <future> // 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 <future> #include <cassert> +#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 f8e90bb5dc3..f08127cdc88 100644 --- a/libcxx/www/cxx1z_status.html +++ b/libcxx/www/cxx1z_status.html @@ -138,7 +138,7 @@ <tr><td><a href="http://wg21.link/P0510R0">P0510R0</a></td><td>LWG</td><td>Disallowing references, incomplete types, arrays, and empty variants</td><td>Issaquah</td><td></td><td></td></tr> <tr><td><a href="http://wg21.link/P0513R0">P0513R0</a></td><td>LWG</td><td>Poisoning the Hash</td><td>Issaquah</td><td></td><td></td></tr> <tr><td><a href="http://wg21.link/P0516R0">P0516R0</a></td><td>LWG</td><td>Clarify That shared_future’s Copy Operations have Wide Contracts</td><td>Issaquah</td><td></td><td></td></tr> - <tr><td><a href="http://wg21.link/P0517R0">P0517R0</a></td><td>LWG</td><td>Make future_error Constructible</td><td>Issaquah</td><td></td><td></td></tr> + <tr><td><a href="http://wg21.link/P0517R0">P0517R0</a></td><td>LWG</td><td>Make future_error Constructible</td><td>Issaquah</td><td>Complete</td><td>4.0</td></tr> <tr><td><a href="http://wg21.link/P0521R0">P0521R0</a></td><td>LWG</td><td>Proposed Resolution for CA 14 (shared_ptr use_count/unique)</td><td>Issaquah</td><td></td><td></td></tr> <!-- <tr><td></td><td></td><td></td><td></td><td></td><td></td></tr> --> |

