The test case fails with .../26_numerics/fabs_inline.cc: In function `int main()': .../26_numerics/fabs_inline.cc:33: error: converting overloaded function `fabs' to type `double (*)(double)' is ambiguous /usr/include/bits/mathinline.h:84: error: candidates are: double fabs(double) <internal>:0: error: double std::fabs(double) I believe it's not a c++ front end problem because the same .i file produces the same error when compiled with an i686-linux compiler. That said, I can't figure out why this error occurs at all. The test case passes on i686-linux; both systems use glibc, and both systems provide a version of fabs in /usr/include/bits/mathinline.h. Can someone with more C++ Fu help me out?
Created attachment 4328 [details] preprocessed fabs_inline test case
Here's the requested C++-fu: This is a problem in the C++ front end with built-ins and using declarations. Here's a smaller testcase: ----------------------------- namespace std { double fabs (double); } using std::fabs; double (*p) (double) = &fabs; ----------------------------- We can compile this with 3.2.3, but 3.3 and 3.4 fail like so: g/x> /home/bangerth/bin/gcc-3.3-pre/bin/c++ -c y.cc y.cc:6: error: converting overloaded function `fabs' to type `double (*)(double)' is ambiguous <internal>:6: error: candidates are: double fabs(double) y.cc:2: error: double std::fabs(double) I don't think the call is ambiguous, so it should succeed. I believe that it must have something to do with built-ins because it succeeds if fabs is renamed to something else. W.
By the way, how could this happen that a regression tests started failing? I thought that's why they are there for!? W.
Subject: Re: [3.3/3.4 regression] using declarations and fabs built-in On Wed, Jul 02, 2003 at 05:16:39PM -0000, bangerth at dealii dot org wrote: > By the way, how could this happen that a regression tests started failing? To my knowledge it never passed on alpha-linux. r~
Subject: Re: New: 26_numerics/fabs_inline.cc failure "rth at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes: | PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. | | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11409 | | Summary: 26_numerics/fabs_inline.cc failure | Product: gcc | Version: 3.4 | Status: UNCONFIRMED | Severity: normal | Priority: P2 | Component: libstdc++ | AssignedTo: unassigned at gcc dot gnu dot org | ReportedBy: rth at gcc dot gnu dot org | CC: gcc-bugs at gcc dot gnu dot org | GCC build triplet: alpha-linux | GCC host triplet: alpha-linux | GCC target triplet: alpha-linux | | The test case fails with | | .../26_numerics/fabs_inline.cc: In function `int main()': | .../26_numerics/fabs_inline.cc:33: error: converting | overloaded function `fabs' to type `double (*)(double)' is ambiguous | /usr/include/bits/mathinline.h:84: error: candidates are: double fabs(double) | <internal>:0: error: double std::fabs(double) I'm almost certain that this is a bug introduced by the handling of built-ins. I'm certain I recently raised this issue, and discussed the thing with Roger Sayle. -- Gaby
Subject: Re: [3.3/3.4 regression] using declarations and fabs built-in "bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes: | Here's the requested C++-fu: | This is a problem in the C++ front end with built-ins and using | declarations. Here's a smaller testcase: | ----------------------------- | namespace std { | double fabs (double); | } | using std::fabs; | | double (*p) (double) = &fabs; | ----------------------------- | | We can compile this with 3.2.3, but 3.3 and 3.4 fail like so: | g/x> /home/bangerth/bin/gcc-3.3-pre/bin/c++ -c y.cc | y.cc:6: error: converting overloaded function `fabs' to type `double | (*)(double)' is ambiguous | <internal>:6: error: candidates are: double fabs(double) | y.cc:2: error: double std::fabs(double) Yeah, this is a bug in handling the built-ins. Roger might have something to say on that. This is a hot regression. -- Gaby
*** Bug 9396 has been marked as a duplicate of this bug. ***
According to Phil's regression hunter: Search converges between 2003-03-11-trunk (#150) and 2003-03-12-trunk (#151) Search converges between 2003-03-10-3.3 (#76) and 2003-03-12-3.3 (#77)
*** Bug 10943 has been marked as a duplicate of this bug. ***
Subject: Bug 11409 CVSROOT: /cvs/gcc Module name: gcc Changes by: sayle@gcc.gnu.org 2003-09-06 16:14:31 Modified files: gcc/cp : ChangeLog class.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/overload: builtin3.C Log message: PR c++/11409 * class.c (resolve_address_of_overloaded_function): When building list of matching non-template function decls, ignore anticipated declarations of undeclared or shadowed GCC builtins. * g++.dg/overload/builtin3.C: New test case. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3651&r2=1.3652 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&r1=1.566&r2=1.567 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3029&r2=1.3030 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/overload/builtin3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 11409 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: sayle@gcc.gnu.org 2003-10-05 03:46:59 Modified files: gcc/cp : ChangeLog class.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/overload: builtin3.C Log message: PR c++/11409 * class.c (resolve_address_of_overloaded_function): When building list of matching non-template function decls, ignore anticipated declarations of undeclared or shadowed GCC builtins. * g++.dg/overload/builtin3.C: New test case. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.211&r2=1.3076.2.212 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.499.2.23&r2=1.499.2.24 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.296&r2=1.2261.2.297 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/overload/builtin3.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.8.1
Fixed for 3.3.2 and 3.4.