[cfe-commits] [PATCH][MS][Review request] - Microsoft missing typename

Francois Pichet pichet2000 at gmail.com
Tue Nov 29 11:56:35 PST 2011


ping?

Doug do you have a problem with this patch? Everything is protected by
-fms-compatilibity except for a small change where I moved
getTemplateInstantiationArgs up by a few lines in
InstantiateFunctionDefinition to be able to access the template
argument earlier.


On Mon, Nov 7, 2011 at 7:19 AM, Francois Pichet <pichet2000 at gmail.com> wrote:
> ok now with the patch.
>
> On Mon, Nov 7, 2011 at 6:32 AM, Francois Pichet <pichet2000 at gmail.com> wrote:
>> Hi,
>>
>> This is my solution to the problem of missing typename in MSVC headers.
>> This patch resolves all the cases of missing typename in MSVC 2008
>> standard c++ headers and in MFC code.
>>
>>
>> This deals with 2 situations:
>>
>> 1. T::a where T is a TemplateTypeParmType.
>> In this case we depend on late template parsing to subtitute 'T' with
>> the actual type and then perform a name lookup to check if 'a' is a
>> type.
>>
>>
>>  2. ClassName<T>::a
>> In this case, we'll perform a name lookup in the class template
>> 'ClassName' to check if 'a' ia a type in the pattern.
>>
>>
>> Example:
>>
>> class C {
>>  public:
>>  typedef int type_1;
>> };
>>
>> template <class T>
>> class D {
>>  public:
>>  typedef T type_2;
>> };
>>
>> template <class T>
>> void f() {
>>   T::type_1 var1;         // case 1.
>>   D<T>::type_2 var2;   // case 2.
>>
>> }
>> int main() {
>>   f<C>();
>> }
>>
>> I admit this is a hack, that's why I am asking for review.
>> But given the way clang and MSVC differ in handling template code, I
>> think this is the best we can do.
>>
>




More information about the cfe-commits mailing list