Re: [Boost-bugs] [Boost C++ Libraries] #10899: symbol visibility: cannot catch an exception thrown by boost::throw_exception on mac OS

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #10899: symbol visibility: cannot catch an exception thrown by boost::throw_exception on mac OS
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-12-27 21:18:16


#10899: symbol visibility: cannot catch an exception thrown by
boost::throw_exception on mac OS
-------------------------------------------------+-------------------------
  Reporter: Sébastien Barthélémy | Owner:
  <barthelemy@…> | emildotchevski
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: exception
   Version: Boost 1.55.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------------------------+-------------------------

Comment (by emildotchevski):

 I left my mac at the office so I can't run your test right now, but
 consider that on MSVC the types of exception objects are compared by a
 "strcmp" of the mangled names from their typeinfo. On GCC (probably on
 clang too) what's compared is the address of the typeinfos. That's why the
 visibility matters: when binaries are linked (dynamically or statically),
 unless two typeinfos get recognized as the same type by the linker, they
 won't match in a catch statement. Since each catch statement uses exactly
 one of the possibly many typeinfo objects that exist for the same type,
 depending on where the exception object originated, it might catch it --
 or not.

 Things are even more complicated when virtual inheritance is used in
 exception type hierarchies, which is of course a "best practice". In that
 case the catch lookup has to consider a whole list of typeinfos, and if
 even one of them is different, the exception won't get recognized.

 P.S. I don't think that your problem has anything to do with the mechanics
 of boost::throw_exception, but if you feel otherwise you might try to edit
 that out of your test to verify that.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10899#comment:1>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC