Bug 10136 - Over-pedantic overloading errors
Summary: Over-pedantic overloading errors
Status: RESOLVED DUPLICATE of bug 8316
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.2
: P2 critical
Target Milestone: ---
Assignee: Jason Merrill
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-18 14:06 UTC by redwards
Modified: 2003-06-02 21:18 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description redwards 2003-03-18 14:06:00 UTC
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)

Release:
3.2

Environment:
i486-suse-linux

How-To-Repeat:
g++ -c (file containing fragment in description)
Comment 1 Jason Merrill 2003-03-18 20:39:25 UTC
*** This bug has been marked as a duplicate of 8316 ***