Opened 9 years ago

Last modified 9 years ago

#9069 closed Bugs

boost::to_string(boost::original_exception_type) needs demangling — at Initial Version

Reported by: sarum9in@… Owned by: Emil Dotchevski
Milestone: To Be Determined Component: exception
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:

Description

Header: boost/exception/detail/exception_ptr.hpp

Current definition of original_exception_type is

typedef error_info<struct tag_original_exception_type,std::type_info const *> original_exception_type;

It uses std::type_info to store original type.

Current definition of to_string is

    inline
    std::string
    to_string( original_exception_type const & x ) 
        {   
        return x.value()->name();
        }

to_string() returns std::type_info::name() without demangling, so user gets type name like "St13runtime_error". It would be better to get "std::runtime_error".

I suggest using

    inline
    std::string
    to_string( original_exception_type const & x ) 
        {   
        return units::detail::demangle(x.value()->name());
        }   

units::detail::demangle() is already used in boost::exception library, so no new dependency is introduced.

Change History (0)

Note: See TracTickets for help on using tickets.