[cfe-commits] Linkage and visibility of parameter list
John McCall
rjmccall at apple.com
Tue Jun 5 16:57:31 PDT 2012
On Jun 5, 2012, at 4:39 PM, Douglas Gregor wrote:
> On May 28, 2012, at 9:00 PM, Rafael EspĂndola <rafael.espindola at gmail.com> wrote:
>> Clang computes the linkage and visibility of both parameter lists and
>> arguments lists of templates. As far as I can tell, the parameter list
>> computation is currently dead code. It would only have an effect in
>> cases where the arguments are less restrictive than the parameters.
>> For visibility, this would be something like
>>
>> struct HIDDEN foo {
>> };
>> DEFAULT foo x;
>> template<foo *z>
>> void DEFAULT zed() {
>> }
>> template void zed<&x>();
>>
>> But in case like this we currently pick the first explicit visibility
>> we find (the one in x). I am not sure if it possible to write an
>> equivalent case for linkage.
>
> One can pass nullptr as an argument for a pointer non-type template parameter, in which case we need the parameter list's linkage/visibility.
>
>> There are two patches attached. The first one changes the merging so
>> that the parameter list linkage and visibility computation is no
>> longer dead. The second one simply deletes it. For what it is worth,
>> gcc 4.7 agrees with the second patch.
>
> The first one seems correct to me. Perhaps John would like to weigh in?
I agree that we should be considering template parameter linkage/visibility.
John.
More information about the cfe-commits
mailing list