This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Where did the warning go?
- From: Eivind Lyche MelvÃr <eivind at elm dot no>
- To: gcc-help at gcc dot gnu dot org
- Date: Fri, 13 Feb 2009 17:08:32 +0100
- Subject: 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;
}