[cfe-commits] [patch][3.2] Visibility cleanup and fixes

John McCall rjmccall at apple.com
Wed Apr 18 20:02:09 PDT 2012


On Apr 18, 2012, at 7:11 PM, Rafael EspĂ­ndola wrote:
>> * In a similar way, the attribute in the method bar wins in both A<H>
>> and A<D> in the following cases:
>> 
>>   template <class T> struct HIDDEN A {
>>     static void DEFAULT bar();
>>   };
>>   struct HIDDEN H;
>>   struct DEFAULT D;
>> 
>> Currently clang produces a default symbol for A<D> and a hidden one
>> for A<H>. gcc 4.7 has the same problem:
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52995.
> 
> John asked on IRC why H doesn't override the visibility. My argument
> is that H can make a template instantiation hidden, but from that
> point we handle it as a regular type. With the template out of the
> way, the above example becomes
> 
> struct HIDDEN A_H {
>  static void DEFAULT bar();
> };
> 
> and since we produce a default symbol for bar in this case, so should
> the symbol in the template case be default.

This model doesn't make any sense to me.  It would make sense if
the templated thing were just the class;  but actually, the class and
all of its members and their members recursively are all templated.

I think you're asking for a significantly weirder language model
based on some idea of cleanliness of implementation, and I don't
understand the motivation at all.

John.



More information about the cfe-commits mailing list