Implement P0510 'Make future_error Constructible' adopted in Issaquah

llvm-svn: 286864
This commit is contained in:
Marshall Clow 2016-11-14 18:56:24 +00:00
parent a9548937d6
commit 87f2f1687e
3 changed files with 19 additions and 3 deletions

View File

@ -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_;}

View File

@ -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
}

View File

@ -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_futures 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> -->