This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/7551: g++ does not mind non-void functions which return n ovalue.
- From: Andreas Jaeger <aj at suse dot de>
- To: Tim Barnett <tim dot barnett at tnuk dot co dot uk>
- Cc: nathan at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org,nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
- Date: Sat, 14 Sep 2002 10:26:18 +0200
- Subject: Re: c++/7551: g++ does not mind non-void functions which return n ovalue.
- References: <9119A2F68D96D311BA2200508B5ABD2D01638573@MAILSERVE>
Tim Barnett <tim.barnett@tnuk.co.uk> writes:
> Source file consisting of the following two lines:
>
> int foo(void) { }
> int main(void) { return foo(); }
>
> Gives no warning.
Did you use the warning flags?
$ /opt/gcc/3.2-devel/bin/gcc t.c -Wall
t.c: In function `foo':
t.c:1: warning: control reaches end of non-void function
$ /opt/gcc/3.2-devel/bin/g++ t.c -Wall
t.c: In function `int foo()':
t.c:1: warning: control reaches end of non-void function
This looks correct to me,
Andreas
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj