[Bug libstdc++/48891] std functions conflicts with C functions when building with c++0x support (and using namespace std)
marc.glisse at normalesup dot org
gcc-bugzilla@gcc.gnu.org
Sun Apr 29 13:17:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48891
--- Comment #6 from Marc Glisse <marc.glisse at normalesup dot org> 2012-04-29 13:15:40 UTC ---
I don't think it matters that much whether the return type is int or bool,
compared to the inconvenience of having 2 functions that conflict.
The constexpr qualifier is nice, but not required by the standard, and not even
by gcc which recognizes that extern "C" int isnan(double) is a builtin (note
that it doesn't recognize it anymore if you change the return type to bool,
that should be fixed).
For the same reason (recognized as a builtin), there is no performance
advantage to having it inline.
So I think:
* glibc could change the return type of isnan to bool in C++ (there would be a
regression in that ::isnan wouldn't be constexpr and inline until g++ is taught
the right prototype)
* libstdc++ could import ::isnan in std::, assuming isnan exists. Maybe that
requires a configure test. Maybe that test would be rather fragile (depends on
feature macros). Maybe that's where this stops being a good idea :-(
More information about the Gcc-bugs
mailing list