This isn't quite right. You need to scan up to the outermost such entity. For instance:<div><br></div><div>template<typename T> int *get() { static int k; return &k; }</div><div><br></div><div>/*inline*/</div>
<div>int *f() {</div><div>  struct S {</div><div>    int *g() {</div><div>      struct T {};</div><div>      return get<T>();</div><div>    }</div><div>  } s;</div><div>  return s.g();</div><div>}</div><div><br></div>
<div>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.</div><div><br></div><div>(And technically, in either case, getFormalLinkage for get<...> should return ExternalLinkage.)</div>
<div><br><div class="gmail_quote">On Tue, May 14, 2013 at 12:54 PM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This patch should fix pr15930. I have intentionally not changed the<br>
local type itself to have linkage, so we still produce an error for:<br>
<br>
typedef void (*ftype)();<br>
template<ftype P><br>
struct S {<br>
};<br>
struct foo {<br>
  static void g();<br>
};<br>
inline void bar() {<br>
  struct zed {<br>
    static void g();<br>
  };<br>
  S<zed::g> b;<br>
}<br>
<br>
Instead what the patch does is change what we do when we see a type<br>
with no linkage being used as a template argument.<br>
<br>
Cheers,<br>
Rafael<br>
</blockquote></div><br></div>