[patch] fix pr15930

Rafael EspĂ­ndola rafael.espindola at gmail.com
Fri May 17 15:22:53 PDT 2013


> Yeah, it's as you suspect: 'x' has no linkage, so its address can't be used
> as a non-type template parameter. f<nullptr> here works, and exhibits the
> bug.

Thanks, I reported pr16059 with it.

> The following should also work, but is rejected, because we incorrectly
> think that foo<S>::x has no linkage (with or without the inline keyword):
>
> template <typename T>
> struct foo {
>   template <T *P> static void f() {
>   }
>   static void *g() {
>     f<&x>();
>   }
>   static T x;
> };
> template<typename T> T foo<T>::x;


and pr16060 for the case with static x.

Cheers,
Rafael



More information about the cfe-commits mailing list