[patch] fix pr15930

Richard Smith richard at metafoo.co.uk
Tue May 14 13:10:39 PDT 2013


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.

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

On Tue, May 14, 2013 at 12:54 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> This patch should fix pr15930. I have intentionally not changed the
> local type itself to have linkage, so we still produce an error for:
>
> typedef void (*ftype)();
> template<ftype P>
> struct S {
> };
> struct foo {
>   static void g();
> };
> inline void bar() {
>   struct zed {
>     static void g();
>   };
>   S<zed::g> b;
> }
>
> Instead what the patch does is change what we do when we see a type
> with no linkage being used as a template argument.
>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130514/2d8b09e8/attachment.html>


More information about the cfe-commits mailing list