From 664e99eac4333f9978959e9d8636b8e0d36527d5 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Fri, 6 Mar 2015 12:31:43 +0000 Subject: [PATCH] future (future_error(error_code)): Construct base class with error_code's message. * include/std/future (future_error(error_code)): Construct base class with error_code's message. * src/c++11/future.cc (future_error::what()): Do not call c_str() on temporary string. From-SVN: r221236 --- libstdc++-v3/ChangeLog | 7 +++++++ libstdc++-v3/include/std/future | 2 +- libstdc++-v3/src/c++11/future.cc | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ed4edf8b89f..4880391798f 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2015-03-06 Jonathan Wakely + + * include/std/future (future_error(error_code)): Construct base + class with error_code's message. + * src/c++11/future.cc (future_error::what()): Do not call c_str() on + temporary string. + 2015-03-05 Jonathan Wakely * include/bits/locale_conv.h (wstring_convert::_M_conv): Handle diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future index cb0226dec4c..fc3f8162ae6 100644 --- a/libstdc++-v3/include/std/future +++ b/libstdc++-v3/include/std/future @@ -98,7 +98,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION public: explicit future_error(error_code __ec) - : logic_error("std::future_error"), _M_code(__ec) + : logic_error("std::future_error: " + __ec.message()), _M_code(__ec) { } virtual ~future_error() noexcept; diff --git a/libstdc++-v3/src/c++11/future.cc b/libstdc++-v3/src/c++11/future.cc index c711a5fe823..3cf503b6b34 100644 --- a/libstdc++-v3/src/c++11/future.cc +++ b/libstdc++-v3/src/c++11/future.cc @@ -75,7 +75,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION future_error::~future_error() noexcept { } const char* - future_error::what() const noexcept { return _M_code.message().c_str(); } + future_error::what() const noexcept { return logic_error::what(); } #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \ && (ATOMIC_INT_LOCK_FREE > 1) -- 2.30.2