[cfe-dev] CLang compiling windows.h from the Windows SDK
Francois Pichet
pichet2000 at gmail.com
Sun Aug 8 16:57:55 PDT 2010
To get around this problem:
I create a file inc.h containing just 1 forward declaration:
struct IUnknown;
Then I call clang using the force include option "-include inc.h"
Work fine for me. For my needs, no patch needed in clang.
On Sun, Aug 8, 2010 at 6:13 PM, Christopher Jefferson
<chris at bubblescope.net> wrote:
>
> 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