[cfe-dev] Parsing MFC code with clang - some info of coming works

Francois Pichet pichet2000 at gmail.com
Sat May 14 14:16:23 PDT 2011


On Mon, May 9, 2011 at 2:36 PM, Sebastian Redl
<sebastian.redl at getdesigned.at> wrote:
>
> On 09.05.2011, at 02:25, Francois Pichet wrote:
>
>> But then there are 2 issues that will be more challenging and I plan
>> to work on them in the coming weeks.
>>
>>
>> 1. Allow to specialize a function within class scope.
>> Example:
>> class A {
>>    template<typename T> _com_ptr_t(T* p)
>>    {
>>    }
>>
>>    template<> _com_ptr_t(char* str)
>>    {
>>    }
>> };
>>
>
> That shouldn't be too hard. AFAIK, this is mostly removing a rather arbitrary restriction.
>

I did some investigation today and it is not so simple.
Given:  (and this occurs in MSVC headers)

  template<class U>
  struct X1 {
     template<class T> void f(T*);
     template<> void f(int*) { }
  };

This code create a situation when you specialize a member function
template without specializing the class template itself. This is
illegal in standard C++ and clang doesn't support that but MSVC does:
http://stackoverflow.com/questions/3052579/explicit-specialization-in-non-namespace-scope


Just removing the arbitrary restriction assert in DeduceTemplateArguments.
I continue to investigate.




More information about the cfe-dev mailing list