http://llvm.org/bugs/show_bug.cgi?id=6492
Summary: NAN not a constant
Product: clang
Version: unspecified
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: enhancement
Priority: P5
Component: -New Bugs
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
I have tested this on the clang build distributed with Snow Leopard, so if it
has already been fixed sorry in advance.
Using the NAN macro from math.h results in this diagnostics:
nantest.c:2:11: error: initializer element is not a compile-time constant
float x = NAN;
^~~
/usr/include/architecture/i386/math.h:66:25: note: instantiated from:
#define NAN __builtin_nanf("0x7fc00000") /* Constant ...
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 diagnostic generated.
where nantest.c contains the following:
---------------
#include <math.h>
float x = NAN;
---------------
This works fine in GCC, but not in Clang and seem to be in violation of C99
7.12:5:
The macro
NAN is defined if and only if the implementation supports quiet NaNs for the
float type. It
expands to a _constant expression_ of type float representing a quiet NaN.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs