http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55655
Bug #: 55655 Summary: cannot export specialized template Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: mw_tr...@users.sourceforge.net Let us say I have a generic template class, e.g. my_smart_ptr. Let us also say I have a class 'foo', 'clas foo : public my_smart_ptr<bar>' that is part of some library public API. And last, let us say that 'foo' needs to specialize 'my_smart_ptr<bar>'. As far as I can tell, it is impossible to export this instantiation with proper symbol visibility in this configuration. I do NOT want to make all possible instantiations of my_smart_ptr have default visibility (someone, somewhere may have an instantiation that should have hidden visibility). I need to do two things, but they are mutually contradictory: 1. I need to explicitly instantiate the template in order to give it default visibility. However, if I do this first, it prevents specialization. (I also get compiler errors for my specific use case, as generic instantiation is not possible.) 2. I need to declare specialization prior to instantiation. However, if I do this before instantiation, I cannot set default visibility on the instantiation and I get link errors. I think there should be a way to do this... Right now I am forced to not export the template, requiring each user to use their own instantiation, which creates a fragile ABI.