[Bug c++/23628] Typeinfo comparison code easily breaks shared libs

mmarcus at emarcus dot org gcc-bugzilla@gcc.gnu.org
Mon Aug 29 20:27:00 GMT 2005


------- Additional Comments From mmarcus at emarcus dot org  2005-08-29 20:23 -------
Actually, I'll just paste the darwin test case here. On this platform, libstdc++
is a sharedlib. The following code:
###

#include <vector>
#include <iostream>
#include <stdexcept>



int main (int argc, char * const argv[]) {
	std::vector<int> v;
	try {
		v.at(1);
	}
	catch(const std::out_of_range& e) {
		std::cout << "Correct behavior: out of range caught, what==: " <<
e.what() << "\n";
		throw;
	}
	catch(...) {
		std::cout << "Oops, apparent problem with type identity across a DLL
boundary\n";
		throw;
	}	
	return 0;
}
###

Output is the "Oops case" when built without explictly setting
-fvisibility=default or -fvisibility-inlines-hidden for the "hosting" exectuable.



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
     Ever Confirmed|                            |1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23628



More information about the Gcc-bugs mailing list