[cfe-dev] clang compiling complex reports err
way_lzl at sina.com
way_lzl at sina.com
Tue Jan 4 01:08:24 PST 2011
No, _Complex is used in MSVC's math.h.
line 135: _CRTIMP double __cdecl _cabs(__in struct _complex _Complex);
Then if I use math.h with Clang on windows, what should I do?
------------------------------------------------
--Zhanglin
----- Original Message -----
From: Francois Pichet <pichet2000 at gmail.com>
To: way_lzl at sina.com
Subject: Re: [cfe-dev] clang compiling complex reports err
Date: 2011-1-4 16:46:49
2011/1/4 <way_lzl at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110104/3c456396/attachment.html>
More information about the cfe-dev
mailing list