If I use MSVC’s math.h, clang will report err I have formed a simple case to show it:
struct _complex {
double x,y;
} ;
#if SHOWERR
void foo( struct _complex _Complex) {
_Complex.x = 0;
}
#else
void foo( struct _complex cc) {
cc.x = 0;
}
#endif
int main()
{
struct _complex cc;
foo(cc);
}
clang aa.cpp -DSHOWERR=1
aa.cpp(7) : error: ‘_Complex struct’ is invalid
void foo( struct _complex _Complex) {
^
It seems _Complex is a reserved key word. Any suggestion?
Thanks
2011/1/4 <way_lzl@sina.com>
If I use MSVC’s math.h, clang will report err I have formed a simple case to show it:
struct _complex {
double x,y;
} ;
#if SHOWERR
void foo( struct _complex _Complex) {
_Complex.x = 0;
}
#else
void foo( struct _complex cc) {
cc.x = 0;
}
#endif
int main()
{
struct _complex cc;
foo(cc);
}
clang aa.cpp -DSHOWERR=1
aa.cpp(7) : error: ‘_Complex struct’ is invalid
void foo( struct _complex _Complex) {
^
It seems _Complex is a reserved key word. Any suggestion?
yes clang considers _Complex to be a reserved keyword, MSVC don’t. But _Complex is not in MSVC headers, it is in your cod right?
So you can rename that variable. Otherwise feel free to submit a PR or a patch.
We had the same problem with the _Bool keyword.