Hi, g++ 4.2.1 doesn't seem to apply hidden visibility to classes after including e.g. <ostream>.
the following testcase was reduced: === Cut === namespace std __attribute__ ((__visibility__ ("default"))) { template < typename A > class C; template < typename A > int foo (C < A > *); template < typename A > class C { public: friend int foo<>(C <A > *); }; extern template class C < char >; } struct TestClass { void hidden(); }; void TestClass::hidden() {} === cut === g++ -O1 -fvisibility=hidden -fvisibility-inlines-hidden -fPIC testcase.cc -c -o nostl.o g++ -shared -o libnostl.so nostl.o nm -CD libnostl.so | grep TestClass gives 0000048c T TestClass::hidden() the symbol is properly hidden if I put the namespace std into default visibility or otherwise try to reduce the code further. -- Summary: [4.2 regression] -fvisibility=hidden not working after including STL headers Product: gcc Version: 4.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: mueller at gcc dot gnu dot org GCC host triplet: i686-suse-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33399