public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11474] New: -Wreturn-type should default to on when compiling C++
@ 2003-07-09 14:24 lloyd at randombit dot net
  2003-07-09 14:39 ` [Bug c++/11474] " bangerth at dealii dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: lloyd at randombit dot net @ 2003-07-09 14:24 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11474

           Summary: -Wreturn-type should default to on when compiling C++
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lloyd at randombit dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-linux
  GCC host triplet: i686-linux
GCC target triplet: i686-linux

This is pretty simple - when using C++, -Wreturn-type should a) always be on,
and b) always cause an error, since not returning correctly from the function
is ALWAYS an error in C++ (seems like it would be in C but I'm not a sufficient
C fiend to say for sure).

For example, the following source file:
-----------------------------
#include <iostream>
#include <ctime>

int foo()
   {
   if(std::time(0) % 2) return 5;
   }

int main()
   {
   std::cout << foo() << std::endl;
   return 0;
   }
-----------------------------

should probably fail to compile (or at least get a warning) regardless of the
flags enabled (unless -Wno-return-type is on, I guess).

Basically, for C++ -Wreturn-type should be turned on by default, and if
somebody wants to turn it off they can.


^ permalink raw reply	[flat|nested] 11+ messages in thread
[parent not found: <bug-11474-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2020-04-26  9:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-09 14:24 [Bug c++/11474] New: -Wreturn-type should default to on when compiling C++ lloyd at randombit dot net
2003-07-09 14:39 ` [Bug c++/11474] " bangerth at dealii dot org
2003-07-13  7:40 ` gdr at integrable-solutions dot net
2003-07-13  7:41 ` gdr at integrable-solutions dot net
2003-07-13  8:22 ` zack at gcc dot gnu dot org
2003-07-13 16:39 ` lloyd at randombit dot net
2003-07-13 16:51 ` jsm at polyomino dot org dot uk
2003-07-14 14:40 ` bangerth at dealii dot org
2003-07-14 14:54 ` gdr at integrable-solutions dot net
2003-07-14 15:12 ` bangerth at dealii dot org
     [not found] <bug-11474-4@http.gcc.gnu.org/bugzilla/>
2020-04-26  9:43 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).