r175326 - Rework the visibility computation algorithm in preparation

John McCall rjmccall at apple.com
Thu Feb 21 09:47:08 PST 2013


On Feb 21, 2013, at 9:14 AM, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:
>> Yes, I think this definition clearly ought to get default visibility
>> regardless of compilation settings.
> 
> I tried to take a look but got lost at what is explicit or implicit
> specialization.

I'm working on it, but to answer your question:

> Given
> 
> class foo {};
> class foo2 {};
> template<typename T>
> class bar {
>  void g();
> };
> template<>
> class __attribute__((visibility("default"))) bar<foo> {
>  void g();
> };
> void bar<foo>::g() {
> }
> template<>
> __attribute__((visibility("default"))) void bar<foo2>::g();
> template<>
> void bar<foo2>::g() {
> }
> 
> we produce a default symbol for bar<foo>::g and a hidden one for
> bar<foo2>::g because bar<foo2> is marked as a implicit instantiation.

This is correct;  bar<foo2> is an implicit instantiation.  bar<foo2>::g()
is an explicit specialization with an explicit attribute, and that should
be enough to suppress the template-related restrictions.

John.



More information about the cfe-commits mailing list