> The template "funcT1" is not a previous declaration of the specialization 
> B::funcT1<int>. But to figure out that the specialization B::funcT1<int> is 
> static we either need the specialization itself to be marked static or we 
> need to walk through getTemplateSpecializationInfo. The member specialization 
> info is for something like:

What is going on is that if a template has static storage class, we
say that the instantiated function has it too. So for example, if I
comment out the call to getTemplateSpecializationInfo, we fail to
compile

struct B {  template <class T> static void funcT1(); };
template <class T> void B::funcT1() {}
void test() {  B::funcT1<int>(); }

but can still compile

struct B {  template <class T> static void funcT1(); };
void test() {  B::funcT1<int>(); }

because there is a static to be copied in this case. Similarly, the
instantiated function in

template<typename T>
struct C {  static void funcT2(); };
template<typename T> void C<T>::funcT2(){}
void test() { C<int>::funcT2(); }

gets marked as static.

Looks like "as written" is a somewhat fuzzy concept for
instantiations. Maybe it would be more regular to say that a
instantiated function gets a static storage class if the template
isStatic()? That should allow us to remove the
getTemplateSpecializationInfo in isStatic().

>         - Doug

Cheers,
Rafael

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to