https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89855

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Ville brought a related case to my attention. With Glibc this compiles, and
finds libc's ::sqrt(double)

#include <cmath>
int i = sqrt(0);

But on Solaris it doesn't even compile. Solaris libc provides all three of
sqrt(float), sqrt(double), sqrt(long double), which makes this ambiguous.

The additional overload that works for integral types is not provided by
Solaris libc's <math_iso.h>, only by <cmath>, and so can't be found here
because there is no 'using std::sqrt;' to put it into the global namespace.

So this compiles and even gives the expected result (returning a double) on
linux, but fails to compile on Solaris.

This suggests that we even need the additional overloads for integral arguments
to be unconditionally dumped into both the global namespace and std.

Reply via email to