-fvisibility=hidden vs. typeinfo

Avi Kivity avi@cloudius-systems.com
Mon Jun 29 08:58:00 GMT 2015

I have some code that looks like

   void some_function() throw (std::out_of_range) {
       ... call to std::map<>::at() which throws out_out_range

if I compile with -fvisibility=hidden, this code calls terminate(). My 
suspicion is that I ended up with two copies of the typeinfo block for 
std::out_of_range; one used by std::__throw_out_of_range() in libstdc++, 
and another in the guard code generated by the compiler.  Since they 
don't match, the guard block terminates.

Is this correct?  If so, is this a bug in libstdc++, or the compiler (or 
the linker)?  If not, what can I do to fix this?

I wasn't able to generate a self contained test case quickly, but if 
there's no other way, I'll invest more effort into it.

More information about the Gcc-help mailing list