This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/43943] "warning: no return statement in function returning non-void" should be an error
- From: "redi at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Apr 2010 11:26:41 -0000
- Subject: [Bug c++/43943] "warning: no return statement in function returning non-void" should be an error
- References: <bug-43943-19097@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from redi at gcc dot gnu dot org 2010-04-30 11:26 -------
The point being that it's undefined behaviour to /return/ from such a function,
not to /write/ such a function.
If the programmer guarantees the "missing return" will never happen then
there's no error.
I was wrong to say it's OK as long as the caller doesn't use the return value -
but it is OK as long as control never reaches the "missing return"
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43943