Mark Mitchell <[EMAIL PROTECTED]> writes: > Jason Merrill wrote: > > Now, templates: > > > > template<class T> __attribute((visibility ("hidden")) T f(T); > > #pragma GCC visibility push(default) > > extern template int f(int); > > #pragma GCC visibility pop > > > > This could really go either way. It could be considered similar to the > > above case in that f<int> is in a way "part" of f<T>, but there isn't > > the same scoping relationship. Also, there isn't the > > declaration/definition problem, as the extern template directive is the > > first declaration of the instantiation. In this case I am inclined to > > respect the #pragma rather than the attribute on the template. > > I'd tend to say that the attribute wins, and that if you want to specify > the visibility on the template instantiation, you must use the attribute > on the instantiation, as you suggest:
Don't you still have to deal with this case? #pragma GCC visibility push(hidden) template<class T> T f(T); #pragma GCC visibility pop ... #pragma GCC visibility push(default) extern template int f(int); #pragma GCC visibility pop Personally I wouldn't mind saying that the attribute always beats the pragma, but it seems to me that there is still the potential for ambiguity. Ian