This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/10641: -Wreturn-type does not work reliably
- From: johannes dot gajdosik at artibrain dot at
- To: gcc-gnats at gcc dot gnu dot org
- Cc: ikock at artibrain dot at
- Date: 6 May 2003 11:20:32 -0000
- Subject: c++/10641: -Wreturn-type does not work reliably
- Reply-to: johannes dot gajdosik at artibrain dot at
>Number: 10641
>Category: c++
>Synopsis: -Wreturn-type does not work reliably
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: accepts-illegal
>Submitter-Id: net
>Arrival-Date: Tue May 06 11:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Isabel Kock, Johannes Gajdosik
>Release: gcc 2.95.3
>Organization:
>Environment:
hpux and linux, gcc 2.95.3
> g++ -v
Reading specs from /opt/gcc/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.95.3/specs
gcc version 2.95.3 20010315 (release)
g++ -v
Reading specs from /usr/lib/gcc-lib/i486-suse-linux/2.95.3/specs
gcc version 2.95.3 20010315 (SuSE)
>Description:
Even with -Wreturn-type the compiler does not warn
when no return value is supplied,
see the following example (only 3 lines of code):
---- test.C begin ----
#include <string>
int f(string) {}
int g(const string &) {}
---- test.C end ---
> g++ -c -Wreturn-type test.C
test.C: In function `int g(const string &)':
test.C:3: warning: control reaches end of non-void function `g(const string &)'
The compiler warns about function g, but there is no
warning about function f.
>How-To-Repeat:
See Description
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: