Public bug reported:

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 has gcc-6.3.0, gcc-5.2.0, gcc-5.1.0 and they all compiled fine.
Godbolt 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.

** Affects: gcc-5 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1617838

Title:
  std::isnan and isnan visibility problems

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1617838/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to