[cfe-commits] [PATCH][MS][Review request] - Microsoft function specialization at scope scope
John McCall
rjmccall at apple.com
Thu Jun 16 19:45:15 PDT 2011
On Jun 16, 2011, at 7:42 PM, Francois Pichet wrote:
> On Thu, Jun 16, 2011 at 9:52 PM, John McCall <rjmccall at apple.com> 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?
Er, yes, sorry.
> The problem is that you cannot call
> CheckFunctionTemplateSpecialization inside a dependent context
> otherwise you'll assert somewhere inside DeduceTemplateArguments.
Ah, right, of course you can't match the specialization against the right
template in the general case.
Okay, carry on. :)
John.
More information about the cfe-commits
mailing list