summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2016-11-12 03:40:24 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2016-11-12 03:40:24 +0000
commit9dbb7881f36e79d08430c401ecbf791665837ae4 (patch)
treed7064649b874219d4ee5e61dfa01a5ba577eced6
parentccdad3853988d801f839d08159e5020b4bf8a9cf (diff)
downloadgcc-9dbb7881f36e79d08430c401ecbf791665837ae4.tar.gz
Add std::future_error constructor from future_errc
* include/std/future (future_error): Make existing constructor private and add constructor from future_errc. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242334 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstdc++-v3/ChangeLog3
-rw-r--r--libstdc++-v3/include/std/future21
2 files changed, 18 insertions, 6 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index f8eb55db79f..00f6670e106 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,8 @@
2016-11-11 Jonathan Wakely <jwakely@redhat.com>
+ * include/std/future (future_error): Make existing constructor
+ private and add constructor from future_errc.
+
* include/bits/shared_ptr.h (hash<shared_ptr<T>>): Use element_type.
* include/bits/shared_ptr_base.h (hash<__shared_ptr<T, L>>): Likewise.
diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future
index fea915b0a87..4d125e8fe9d 100644
--- a/libstdc++-v3/include/std/future
+++ b/libstdc++-v3/include/std/future
@@ -95,11 +95,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
class future_error : public logic_error
{
- error_code _M_code;
-
public:
- explicit future_error(error_code __ec)
- : logic_error("std::future_error: " + __ec.message()), _M_code(__ec)
+ explicit
+ future_error(future_errc __errc)
+ : future_error(std::make_error_code(__errc))
{ }
virtual ~future_error() noexcept;
@@ -109,6 +108,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const error_code&
code() const noexcept { return _M_code; }
+
+ public:
+ explicit
+ future_error(error_code __ec)
+ : logic_error("std::future_error: " + __ec.message()), _M_code(__ec)
+ { }
+
+ friend void __throw_future_error(int);
+
+ error_code _M_code;
};
// Forward declarations.
@@ -426,8 +435,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
if (static_cast<bool>(__res))
{
- error_code __ec(make_error_code(future_errc::broken_promise));
- __res->_M_error = make_exception_ptr(future_error(__ec));
+ __res->_M_error =
+ make_exception_ptr(future_error(future_errc::broken_promise));
// This function is only called when the last asynchronous result
// provider is abandoning this shared state, so noone can be
// trying to make the shared state ready at the same time, and