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

failure to warn about an obvious error


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


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