[cfe-dev] clang compiling complex reports err
Francois Pichet
pichet2000 at gmail.com
Tue Jan 4 00:46:49 PST 2011
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/b13abe23/attachment.html>
More information about the cfe-dev
mailing list