c++/7551: g++ does not mind non-void functions which return n o value.
Andreas Jaeger
aj@suse.de
Sat Sep 14 02:28:00 GMT 2002
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
More information about the Gcc-bugs
mailing list