Where did the warning go?

Eivind Lyche Melvær eivind@elm.no
Fri Feb 13 16:07:00 GMT 2009


Greetings,
The code below used to (and should, in my opinion) generate a warning  
about implicit conversion. I have tried four different versions of g++:

   g++ 4.1.3 20080704 (prerelease) (Debian 4.1.2-25)
   g++ 4.2.4 (Debian 4.2.4-6)
   g++ 4.3.2 (Debian 4.3.2-1.1)
   g++ 4.3.3

Only the oldest version (4.1.3) gives me the warning that I'm after:

   warning: passing ‘double’ for argument 1 to ‘void print(int)’

The other three versions give no warning at all, even though I compile  
with -Wall and -Wextra. So it looks like the warnings disappeared  
somewhere after version 4.1.3. Is this a bug? Or is there a way to enable  
these warnings in the more recent versions of g++?

Thanks,
Eivind LM


#include <iostream>

void print(int number) {
   std::cout << number << std::endl;
}

int main() {

   double d = 1.5;
   print(d);
   return 0;

}



More information about the Gcc-help mailing list