This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/33399] New: [4.2 regression] -fvisibility=hidden not working after including STL headers
- From: "mueller at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Sep 2007 20:37:06 -0000
- Subject: [Bug c++/33399] New: [4.2 regression] -fvisibility=hidden not working after including STL headers
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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