[Issue 23411] New: ImportC: undefined identifier __builtin_nanf
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Oct 13 22:42:40 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23411
Issue ID: 23411
Summary: ImportC: undefined identifier __builtin_nanf
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: ImportC
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dave287091 at gmail.com
The following C file fails to compile
#include <math.h>
float x = NAN; // Error: undefined identifier `__builtin_nanf`, did you mean
template `__builtin_inf()()`?
On macOS, the standard C macro NAN is defined as:
#define NAN __builtin_nanf("0x7fc00000")
On x64 linux, it is defined as:
# define NAN (__builtin_nanf (""))
So the above file preprocesses to:
float x = __builtin_nanf("0x7fc00000");
Looking at https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html, there’s also
__builtin_nan and __builtin_nanl.
--
More information about the Digitalmars-d-bugs
mailing list