This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/27577] New: Change "control reaches end of non-void function" to an error, when a complex type gets returned
- From: "wfor at arcor dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 May 2006 18:14:07 -0000
- Subject: [Bug c++/27577] New: Change "control reaches end of non-void function" to an error, when a complex type gets returned
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
At least on x86 and x86_64 the following program crashes
------------8<--------------
#include <string>
std::string foo()
{
}
int main()
{
foo();
}
------------8<--------------
When one compiles this snipplet with warnings turned on, then this warning
shows up:g++ -Wall m.c
m.c: In function `std::string foo()':
m.c:5: warning: control reaches end of non-void function
Although, a missing return type for a primitive type like int, float, ... is
sure not worth an error, not returning a complex type like std::string which
crashes the program should be treated as an error.
Yes, I am fully aware, that my snipplet is buggy, however an ignored warning
should not cause a crash in the program.
--
Summary: Change "control reaches end of non-void function" to an
error, when a complex type gets returned
Product: gcc
Version: 3.4.4
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: wfor at arcor dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27577