Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

cmath does not work with clang -std=c++0x or -std=c++93 #9564

Closed Quuxplusone closed 13 years ago

Quuxplusone commented 13 years ago
Bugzilla Link PR9205
Status RESOLVED WORKSFORME
Importance P normal
Reported by Christopher Jefferson (chris@bubblescope.net)
Reported on 2011-02-12 16:36:32 -0800
Last modified on 2011-04-01 07:34:35 -0700
Version unspecified
Hardware PC All
CC jonathan.sauer@gmx.de, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also

A simple:

include

does not work on mac os x 10.6, with clang -std=c++0x or clang -std=c++93. It works fine with -std=gnu++0x and -std=gnu++93.

I had assumed that -std=c++0x was the 'natural' extension to get c++0x support. I can see I should probably be using gnu++0x. That is an unfortunate choice of naming (but probably clang's fault).

Quuxplusone commented 13 years ago
This is AFAIK a bug in Apple's math.h headers. See
<http://lists.cs.uiuc.edu/pipermail/cfe-dev/2010-August/010176.html>:

| I had to add an additional tweak to the cmath header for OSX when
| building with Clang with -std=c++0x, as that flag disables the GNU
| extensions mode and defines __STRICT_ANSI__, and the current math.h
| headers with OSX/iOS (Xcode 3.2.3) don't bring in a number of the C99
| math functions when __STRICT_ANSI__ is defined.

I solved the problem by changing the buggy math.h on my system.

You are correct that 'c++0x' is used to enable C++0x support. Clang works as
expected here.

@Howard: Close this bug? (after filing a radar for math.h)
Quuxplusone commented 13 years ago

Closed. Bug has been filed (and fixed) for math.h on OS X.