diff --git a/include/boost/exception/exception.hpp b/include/boost/exception/exception.hpp index 3d5383d..53e6ed0 100644 --- a/include/boost/exception/exception.hpp +++ b/include/boost/exception/exception.hpp @@ -313,7 +313,8 @@ boost exception_detail::enable_error_info_return_type::type enable_error_info( T const & x ) { - return typename exception_detail::enable_error_info_return_type::type(x); + typedef typename exception_detail::enable_error_info_return_type::type rt; + return rt(x); } //////////////////////////////////////////////////////////////////////// diff --git a/include/boost/exception/get_error_info.hpp b/include/boost/exception/get_error_info.hpp index dac239c..ec2b792 100644 --- a/include/boost/exception/get_error_info.hpp +++ b/include/boost/exception/get_error_info.hpp @@ -10,7 +10,6 @@ #include #include #include -#include namespace boost @@ -21,30 +20,16 @@ boost struct strwrap { - char const * str; + std::string str; + char const * ptr; strwrap( char const * s ): - str(init(s)) + str(s), + ptr(&str[0]) { } - ~strwrap() - { - delete[] str; - } - private: - strwrap( strwrap const & ); strwrap & operator=( strwrap const & ); - - static - char const * - init( char const * s ) - { - size_t n=1+strlen(s); - char * str = new char[n]; - (void) memcpy(str,s,n); - return str; - } }; template <> @@ -55,10 +40,10 @@ boost shared_ptr get( exception const & x ) { - if( x.throw_function_ ) + if( x.throw_function_ && *x.throw_function_ ) { shared_ptr s(new strwrap(x.throw_function_)); - return shared_ptr(s,&s->str); + return shared_ptr(s,&s->ptr); } else return shared_ptr(); @@ -73,10 +58,10 @@ boost shared_ptr get( exception const & x ) { - if( x.throw_file_ ) + if( x.throw_file_ && *x.throw_file_ ) { shared_ptr s(new strwrap(x.throw_file_)); - return shared_ptr(s,&s->str); + return shared_ptr(s,&s->ptr); } else return shared_ptr(); diff --git a/include/boost/exception_ptr.hpp b/include/boost/exception_ptr.hpp index 15f0ea2..196329d 100644 --- a/include/boost/exception_ptr.hpp +++ b/include/boost/exception_ptr.hpp @@ -99,7 +99,7 @@ boost private: - clone_base const * + exception_detail::clone_base const * clone() const { return new unknown_exception(*this);