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]
Other format: [Raw text]

[Bug c++/27577] New: Change "control reaches end of non-void function" to an error, when a complex type gets returned


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


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