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

From: Raphael Kubo da Costa <rakuco_at_FreeBSD.org>
Date: Mon, 29 Jul 2013 08:27:29 -0300
David Chisnall <theraven_at_FreeBSD.org> writes:

> On 28 Jul 2013, at 22:27, Raphael Kubo da Costa <rakuco_at_freebsd.org> 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
-stdlib=libc++:

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

% clang++ isnan.cc
isnan.cc:4:10: 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,
        __inline_isnanl)
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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.
Received on Mon Jul 29 2013 - 09:27:38 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:39 UTC