https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47877
--- Comment #3 from Jan Engelhardt <jengelh at inai dot de> --- Hm yes, I begin to see why this was done. Template instantiations show up as W-type symbols in `nm`, and template specializations are 'T'-type, and both need to be visible so that the override works. But only on -O0. When compiling with -O2, the template instantiations gets inlined and the symbol (_ZN3Foo3barIS_EEvv in this example) disappears because of -fvisibility-inlines-hidden and could not possibly be overridden. So template specializations from elsewhere will have no effect. ... So IMO we can probably just drop the "!processing_template_decl" part.