template: warning address need more info

Yotam Medini yotamm@tmai.com
Wed Oct 29 13:21:00 GMT 1997


Here is the example:

 telaviv:352> cat ip.cc
 #include <algorithm>

 int ip2(const double* p2)
 {
    double  m2[2];  m2[0] = 2.;  m2[1] = 3.;
    double p2m2 = inner_product(p2, p2 + 2, m2, 0);
 }
 telaviv:353> egcs++ -c ip.cc
 /home/seg/yotam/build/dryinst.Solaris/include/g++/algo.h: In function `int inner_product(const double *, const double *, double *, int)':
 /home/seg/yotam/build/dryinst.Solaris/include/g++/algo.h:2453: warning: assignment to `int' from `double'
 telaviv:354> 

The last parameter should be (0.) and not (0).
But the warning does not point to the right place, 
namely  ip.cc:6.

By the way, shouldn't the (0) be promoted to (0.) automatically?
If not, 
  * how come there was a match?
  * one would expect the warning to be the opposite, that is:
     assignment to `double' from `int'

-- yotam



More information about the Gcc-bugs mailing list