[cfe-dev] Function template specializations

Vassil Vassilev vasil.georgiev.vasilev at cern.ch
Tue Dec 10 04:48:26 PST 2013


Hi,
   IIUC when clang instantiates a function template it 'injects' a 
canonical declaration so that it can register it as a template 
specialization in the list of specializations. Is there any way to 
distinguish between implicitly 'injected' one and a forward declaration 
of the same. Eg:

   template<typename T> T f(){ return T();} template<> int f() { return 
0;} // here clang will inject a canonical declaration implicitly IIUC
   template<typename T> T f(){ return T();} template<> int f(); 
template<> int f() { return 0;} // and here it won't because it was 
forward declared:

   So my question is given the template specialization definition could 
I distinguish between the both cases.
Many thanks,
Vassil



More information about the cfe-dev mailing list