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 <
[email protected]> 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
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to