gcc -Waddress got a little bit worse between gcc 4.0.4 and gcc 4.1.2. It would be useful to get this warning, especially for C++ inline methods.
[EMAIL PROTECTED]:~/exp-address$ cat z2.cc extern bool Alpha(); inline bool Beta(bool b) { return b; } class MyClass { public: static bool MyMethod(bool b) { return b; } }; bool Gamma() { if (Alpha) { if (Beta) { if (MyClass::MyMethod) { return true; } } } return false; } [EMAIL PROTECTED]:~/exp-address$ /home/mec/gcc-4.0.4/install/bin/g++ -Wall -O2 -S z2.cc z2.cc: In function 'bool Gamma()': z2.cc:6: warning: the address of 'bool Alpha()', will always evaluate as 'true' z2.cc:7: warning: the address of 'bool Beta(bool)', will always evaluate as 'true' z2.cc:8: warning: the address of 'static bool MyClass::MyMethod(bool)', will always evaluate as 'true' [EMAIL PROTECTED]:~/exp-address$ /home/mec/gcc-4.1.2/install/bin/g++ -Wall -O2 -S z2.cc z2.cc: In function 'bool Gamma()': z2.cc:6: warning: the address of 'bool Alpha()', will always evaluate as 'true' [EMAIL PROTECTED]:~/exp-address$ /home/mec/gcc-4.2.2/install/bin/g++ -Wall -O2 -S z2.cc z2.cc: In function 'bool Gamma()': z2.cc:6: warning: the address of 'bool Alpha()' will always evaluate as 'true' [EMAIL PROTECTED]:~/exp-address$ /home/mec/gcc-4.3-20071019/install/bin/g++ -Wall -O2 -S z2.cc z2.cc: In function 'bool Gamma()': z2.cc:6: warning: the address of 'bool Alpha()' will always evaluate as 'true' [EMAIL PROTECTED]:~/exp-address$ -- Summary: gcc -Waddress lost some useful warnings Product: gcc Version: 4.2.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: mec at google dot com GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33925