This is the mail archive of the gcc-help@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]

Where did the warning go?


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;

}


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