[cfe-dev] CLang compiling windows.h from the Windows SDK
Douglas Gregor
dgregor at apple.com
Mon Aug 9 20:03:54 PDT 2010
Sent from my iPhone
On Aug 9, 2010, at 7:19 PM, Francois Pichet <pichet2000 at gmail.com> wrote:
> You are right. MSVC doesn't allow typedef redefinition after all.
> Here is a code simplification of what is happening in windows.h
>
> struct A {
> char a;
> char b;
> };
>
> typedef int foo[1];
> typedef int foo[(long)&(((A *)0)->b)];
This looks like an offsetof implementation. We're probably not treating it as a constant expression (but that's another guess), since C/C++ doesn't consider it to be a constant expression (GCC and VC++ have extensions in this area).
> clang will flag the second typedef as a redefintion. msvc and gcc don't.
>
>
>
> On Sun, Aug 8, 2010 at 4:07 PM, Douglas Gregor <dgregor at apple.com> wrote:
>
>>>
>>> In C mode there are only 2 kinds of error:
>>> 1- MSVC allows typedef redefinition with a different type, CLang doesn't.
>>
>> What types are involved? This may be a symptom of a different incompatibility in the type system.
>>
More information about the cfe-dev
mailing list