[patch] fix pr15930

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue May 14 21:29:20 PDT 2013


On 14 May 2013 16:10, Richard Smith <richard at metafoo.co.uk> wrote:
> This isn't quite right. You need to scan up to the outermost such entity.
> For instance:
>
> template<typename T> int *get() { static int k; return &k; }
>
> /*inline*/
> int *f() {
>   struct S {
>     int *g() {
>       struct T {};
>       return get<T>();
>     }
>   } s;
>   return s.g();
> }
>
> Here, we should not treat get<f::S::g::T> as being externally-visible, but
> if we uncomment the 'inline', then it should be externally-visible.

I finally understand what you went by outermost in the bug report.
Thanks, a new patch is attached.

> (And technically, in either case, getFormalLinkage for get<...> should
> return ExternalLinkage.)

That is defect is the standard, no? In the non-inline case there is no
way for another TU to refer to this and the current draft defines
external linkage as

* When a name has external linkage , the entity it denotes can be
referred to by names from scopes of other translation units or from
other scopes of the same translation unit.

Cheers,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.patch
Type: application/octet-stream
Size: 4251 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130515/26833030/attachment.obj>


More information about the cfe-commits mailing list