CURRENT: CLANG 3.3 and -stad=c++11 and -stdlib=libc++: isnan()/isninf() oddity

Raphael Kubo da Costa rakuco at
Mon Jul 29 11:27:38 UTC 2013

David Chisnall <theraven at> writes:

> On 28 Jul 2013, at 22:27, Raphael Kubo da Costa <rakuco at> wrote:
>> This seems to have been committed in r253321, and broke some code that
>> was working with r253320; namely, some code in x11/kde4-workspace
>> includes math.h and calls isnan() with a const double.
> Please provide a test case.  Specifically, I need to know what
> language dialect this is using, because I have tested including math.h
> and calling isnan(double) with c89, gnu89, c99, c11, c++03 and c++11
> on gcc (for the modes that it supports) and clang.

I get the following results with and without -std=c++11 and/or

% cat
#include <math.h>
int main() {
  const double d = 42.0;
  return isnan(d) ? 1 : 0;

% clang++ error: controlling expression type 'const double' not
compatible with any generic association type
  return isnan(d) ? 1 : 0;
/usr/include/math.h:109:2: note: expanded from macro 'isnan'
        __fp_type_select(x, __inline_isnanf, __inline_isnan,
/usr/include/math.h:86:49: note: expanded from macro '__fp_type_select'
#define __fp_type_select(x, f, d, ld) _Generic((0,(x)),
1 error generated.

More information about the freebsd-standards mailing list