[cfe-dev] CLang compiling windows.h from the Windows SDK

Christopher Jefferson chris at bubblescope.net
Sun Aug 8 15:13:23 PDT 2010


On 8 Aug 2010, at 21:07, Douglas Gregor wrote:

> 
>> 3. CLang doesn't like:
>>    template<typename T> void** IID_PPV_ARGS_Helper(T** pp)
>>    {
>>       static_cast<IUnknown*>(*pp);            <=== clang error:
>> unknown type name 'IUnknown'
>>       return reinterpret_cast<void**>(pp);
>>    }
>> Note that 'IUnknown' is actually undefined at this point but MSVC accept it.
> 
> Is it truly undeclared, or is it some kind of magic type? The former is very hard to deal with. 

It is truly undeclared, this is due to windows being lax on what it accepts in templates. However, with some careful consideration, clang could possibly consider making it a magic type, if there is only a very small number of such hacks required to parse windows.h. I haven't done a careful analysis of how many such examples there are.

Chris



More information about the cfe-dev mailing list