On Thu, Jun 16, 2011 at 9:52 PM, John McCall <[email protected]> wrote: > > On Jun 16, 2011, at 6:26 PM, Francois Pichet wrote: > >> I struggled getting this patch right and I am not confident enough to >> submit it directly without review so here it is: >> Template function specialization at class scope for -fms-extensions >> >> Example: >> template <class T> >> class B { >> public: >> template <class U> >> void f(U p) { } >> >> template <> >> void f(int p) { } // <= not standard C++, Microsoft extension >> }; >> >> As Doug suggested to me on the IRC chat, I created a new Decl node: >> ClassScopeFunctionSpecializationDecl >> This node hold a temporary CXXMethodDecl and it will use it to create >> an explicit specialization during class instantiation. > > Can you explain the need to do this rather than simply making this > a FunctionTemplateSpecializationDecl, like it would be at global > scope? There's already code in SemaTemplateInstantiateDecl for > instantiating such things; I'm sure it would need to be changed, > but... > > John. >
What is a FunctionTemplateSpecializationDecl? I can't find it. I suppose you mean a FunctionDecl whose TemplateOrSpecialization member is a FunctionTemplateSpecializationInfo? The problem is that you cannot call CheckFunctionTemplateSpecialization inside a dependent context otherwise you'll assert somewhere inside DeduceTemplateArguments. As such, the idea is to postpone CheckFunctionTemplateSpecialization until you are no longer inside a dependent context. I tried many approaches that failed until dgregor suggested to me to create that ClassScopeFunctionSpecializationDecl node and to spawn the specialization during class instantiation. does that answer your question? _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
