bug: ambiguous fabs/sqrt/isdigit/etc
Geoffrey Furnish
furnish@actel.com
Fri Aug 25 14:43:00 GMT 2000
Found also in the 20000821 snapshot, gcc claims this code is
ambiguous.
valinux[39] cat z.cc
#include <cmath>
using namespace std;
void f()
{
double x = 1, y;
y = fabs(x);
}
valinux[40] c++ -c z.cc
z.cc: In function `void f ()':
z.cc:7: call of overloaded `fabs (double &)' is ambiguous
/usr/include/bits/mathcalls.h:165: candidates are: double fabs (double)
/va1/furnish/gcc/include/g++-v3/bits/std_cmath.h:423: long double std::fabs (long double)
/va1/furnish/gcc/include/g++-v3/bits/std_cmath.h:310: double std::fabs (double)
/va1/furnish/gcc/include/g++-v3/bits/std_cmath.h:140: float std::fabs (float)
valinux[41]
I think this must be a bug.
This happens with other math ops mirrored by compiler intrinsics as
well, for example sqrt.
BTW, the same sort of problem also arises when including <cctype> and
using isdigit, etc.
--
Geoffrey Furnish Actel Corporation furnish@actel.com
Senior Staff Engineer 955 East Arques Ave voice: 408-522-7528
Placement & Routing Sunnyvale, CA 94086-4533 fax: 408-522-8041
More information about the Gcc-bugs
mailing list