[cfe-dev] clang compiling complex reports err

John McCall rjmccall at apple.com
Tue Jan 4 17:34:00 PST 2011


On Jan 4, 2011, at 5:21 PM, Douglas Gregor wrote:

> 
> On Jan 4, 2011, at 5:08 PM, John McCall wrote:
> 
>> On Jan 4, 2011, at 1:44 AM, Francois Pichet wrote:
>>> 2011/1/4 <way_lzl at sina.com>
>>> No, _Complex is used in MSVC's math.h. 
>>> 
>>> line 135: _CRTIMP double  __cdecl _cabs(__in struct _complex _Complex);
>>> 
>>> 
>>> Ok that's in Visual Studio 2005. It was changed in MSVC 2008 to not use _Complex as parameter name.
>>>   
>>> Then if I use math.h with Clang on windows, what should I do?
>>> 
>>> Either you submit a patch to fix it yourself or you can submit a PR and wait for someone else to fix it.
>>> Otherwise use VS 2008.
>> 
>> _Complex should really be a C99-only keyword.  If we did that, then you could compile as C89 without a problem.
> 
> GCC accepts _Complex as a keyword in C++ mode. We could turn that off in Microsoft C++ mode, of course.

I meant C99 as "not in C89", because IIRC complex numbers were added in C99;  but it looks like GCC treats _Complex as a keyword even in -std=c89, and it's probably best to emulate that.

It definitely sounds like _Complex shouldn't be a keyword in VS2005 mode.

John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110104/7eaef9fa/attachment.html>


More information about the cfe-dev mailing list