Bug in Ubuntu 16.04 stock gcc-5.4.0 standard library

Steve Lorimer steve.lorimer at gmail.com
Wed Aug 24 18:59:18 UTC 2016

Consider the following small test application:

#include <iostream>#include <cmath>#include <math.h>
int main(){
    double d = NAN;

    std::cout << std::isnan(d) << '\n';
    std::cout << isnan(d) << '\n';

    return 0;}

Compiling on Ubuntu 16.04 with g++-5.4.0 using C++11 standard fails:

$ g++ -std=c++11 main.cpp
main.cpp: In function ‘int main()’:
main.cpp:10:25: error: ‘isnan’ was not declared in this scope
     std::cout << isnan(d) << '\n';
main.cpp:10:25: note: suggested alternative:In file included from
main.cpp:3:0:/usr/include/c++/5/cmath:641:5: note:   ‘std::isnan’
     isnan(_Tp __x)

I've compiled this on Centos gcc-4.9.1 and gcc-5.2.1 and it works on both.
I've compiled this on Ubuntu gcc-4.9.3 and that too works.
However, compiling on Ununtu gcc-5.4.0 doesn't.

I've also tried several online compilers, with mixed results.

Wandbox <http://melpon.org/wandbox/> has gcc-6.3.0, gcc-5.2.0, gcc-5.1.0
and they all compiled fine.
Godbolt <http://gcc.godbolt.org/#> broke for gcc-4.9.2 through gcc-5.3, but
then works on 6.1.

Given it works for gcc-5.2.0 on Wandbox and breaks for gcc-5-2.0 on Godbolt
makes me thing one must be using a patched standard library.

Not sure how to report this bug?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-bugsquad/attachments/20160824/56e0ea89/attachment.html>

More information about the Ubuntu-bugsquad mailing list