This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
failure to warn about an obvious error
- To: gcc-bugs at gcc dot gnu dot org
- Subject: failure to warn about an obvious error
- From: Andrew Koenig <ark at research dot att dot com>
- Date: Tue, 16 Nov 1999 19:03:59 -0500 (EST)
gcc 2.95.1 (under Solaris 2.6, but I doubt it matters)
compiles the following program without a peep:
#include <vector>
std::vector<int> f() { }
Technically speaking, this translation unit is well-formed,
but its behavior is undefined if it is called.
If -pedantic is turned on, the compiler says
warning: control reaches end of non-void function `f()'
It would be real nice if g++ were more aggressive about this
particular warning, especially in cases where the actual generated
code will crash if invoked.
--
Andrew Koenig, ark@research.att.com, http://www.research.att.com/info/ark