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]

Re: c++/7551: g++ does not mind non-void functions which return n ovalue.


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


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