This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/10136: Over-pedantic overloading errors
- From: redwards at astro dot uva dot nl
- To: gcc-gnats at gcc dot gnu dot org
- Date: 18 Mar 2003 14:05:11 -0000
- Subject: c++/10136: Over-pedantic overloading errors
- Reply-to: redwards at astro dot uva dot nl
>Number: 10136
>Category: c++
>Synopsis: Over-pedantic overloading errors
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Mar 18 14:06:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: R. Edwards
>Release: 3.2
>Organization:
>Environment:
i486-suse-linux
>Description:
Sorry I don't know the ins and outs of the Standard well enough to know if this is a "new bug" and not just an "annoying new feature", but the fact that the following code dies with an error message seems strange to me.
#include <cmath>
void f()
{
float a, b=1.0;
a = std::pow(b, 1.5);
}
Surely the compiler should just promote b to a double without even emitting a warning message? If not, what is the proper way to do this? Stick (double) in a zillion places in the code?
Also, the error message for this kind of error is pretty cryptic, especially in the case of operators. Here is an example from my code, which is much too big and ugly to supply here:
pbird.cc:102: choosing `PhysData::PhysDataPoint<T> PhysData::operator*(const
PhysData::PhysDataPoint<T>&, double) [with T = double]' over `operator*'
pbird.cc:102: because worst conversion for the former is better than worst
conversion for the latter
Firstly, great you made the right choice, why are you giving an error message about it?? Secondly, choosing it over _which_ operator* ??
(I know there is a previous bug report on this but no progress seemed to be made)
>How-To-Repeat:
g++ -c (file containing fragment in description)
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: