The following code compiled with -fvisibility=hidden produces only typeinfo symbols with hidden visibility:
#define GOTT_EXPORT __attribute__ ((visibility("default"))) template<class T> struct GOTT_EXPORT spelled_t {}; template<class T> inline std::type_info const &spell() { return typeid(spelled_t<T>); } ... spell<long>() readelf -sW says: 1441: 0000000000180800 16 OBJECT LOCAL HIDDEN 22 _ZTIN4gott4xany9spelled_tIlEE 2536: 0000000000058cb0 26 OBJECT LOCAL HIDDEN 12 _ZTSN4gott4xany9spelled_tIlEE gcc -v says: Reading specs from /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.4/specs Configured with: /var/tmp/portage/gcc-3.4.4-r1/work/gcc-3.4.4/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/3.4.4 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.4/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4.4 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4.4/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4.4/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.4/include/g++-v3 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --disable-libunwind-exceptions --enable-multilib --disable-libmudflap --disable-libgcj --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu Thread model: posix gcc version 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8) -- Summary: no typeinfo for template class if requested by __attribute__(((visibility("default"))) Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: aribrei at arcor dot de http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25592