On Fri, Oct 19, 2012 at 2:03 AM, Ed Schouten <[email protected]> wrote:
> Hi Eli,
>
> Thanks again for taking your time to review my patch!
>
> 2012/10/19 Eli Friedman <[email protected]>:
>> +  if (var->isThisDeclarationADefinition() &&
>> +      (var->getLinkage() == ExternalLinkage ||
>> +      var->getLinkage() == UniqueExternalLinkage)) {
>>
>> We don't want to warn for code like the following, which is what
>> UniqueExternalLinkage is used for:
>>
>> namespace {
>>   int x;
>> }
>
> The problem is that if I don't check for UniqueExternalLinkage, it
> won't trigger a warning for this code, even though it should:
>
> struct {
>   int foo;
> } bar;

In C (or C++ in an 'extern "C"' block), "bar" shouldn't have
UniqueExternalLinkage.  In C++, there isn't any reason to warn here:
"bar" can't be referenced from any other translation unit.  See
[basic.link]p8 in the standard.

-Eli
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to