This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/10136: Over-pedantic overloading errors


>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]