This was already reported upstream by SAP in GCC Bugzilla – Bug 52973: "In following code, gcc-4.7 does not accept the visibility attribute defined in the class declaration: template <class T> class __attribute__((visibility("default"))) a { public: /* A */ static int c; }; class __attribute__((visibility("default"))) b : a <b> {}; template<> /* B */ int a<b>::c = 0; With g++-4.7, a<b>::c is hidden, with g++-4.6 (and before) it is not. $ g++-4.7 -fvisibility=hidden -c def.cpp && objdump -Ct def.o | grep "a<b>" 0000000000000000 g O .bss 0000000000000004 .hidden a<b>::c $ g++-4.6 -fvisibility=hidden -c def.cpp && objdump -Ct def.o | grep "a<b>" 0000000000000000 g O .bss 0000000000000004 a<b>::c Setting the default visibility at /* A */ or /* B */ works with g++-4.7, but I think that it still should work also with the code above." According to the upstream bugzilla, this is fixed in gcc 4.7.1. It would be useful for SAP if the fix could also be integrated in the gcc shipped with the Developer Toolset.
Jakub indicated fixed in devtoolset-1.1-gcc-4.7.1-7.el6 so attaching to erratum RHEA-2012:13624-01
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHEA-2013-0177.html