------- Comment #5 from redi at gcc dot gnu dot org 2010-03-17 10:54 ------- I think the behaviour is intentional, for the same reasons described at http://gcc.gnu.org/wiki/Visibility#Problems_with_C.2B-.2B-_exceptions_.28please_read.21.29 Instantiated templates (such as Foo::foo<int>) have vague linkage so cannot be hidden.
Quoting from the wiki page: Symbol visibility is "default" by default but if the linker encounters just one definition with it hidden - just one - that [...] symbol becomes permanently hidden (remember the C++ standard's ODR - one definition rule). ... The same issue can arise with other vague linkage entities such as static data members of a class template. If the class has hidden visibility, the data member can be instantiated in multiple DSOs and referenced separately, causing havoc. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43376