fork download
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. namespace foo {
  5. template<class T>
  6. inline bool isnan (T x)
  7. { //!< \brief return true if floating-point type t is NaN (Not A Number).
  8. std::cout << "foo::isnan" << std::endl;
  9. return true;
  10. }
  11. }
  12.  
  13. using foo::isnan;
  14. using std::isnan;
  15.  
  16. int main () {
  17. std::cout << isnan(5.5f) << std::endl;
  18. return 0;
  19. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:14:12: error: 'constexpr bool std::isnan(double)' conflicts with a previous declaration
 using std::isnan;
            ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/i386-linux-gnu/c++/5/bits/os_defines.h:39,
                 from /usr/include/i386-linux-gnu/c++/5/bits/c++config.h:482,
                 from /usr/include/c++/5/iostream:38,
                 from prog.cpp:1:
/usr/include/i386-linux-gnu/bits/mathcalls.h:234:1: note: previous declaration 'int isnan(double)'
 __MATHDECL_1 (int,isnan,, (_Mdouble_ __value)) __attribute__ ((__const__));
 ^
stdout
Standard output is empty