No warning when return type is missing

Alexandre Oliva oliva@dcc.unicamp.br
Sun Feb 28 23:30:00 GMT 1999


On Feb  5, 1999, us@ooc.de (Uwe Seimet) wrote:

> T* foo() { The code in here doesn't return anything.  }

> When compiling such an example with c++ even with -Wall or -Wno-return-type
> you don't get any warning and implicitly a null pointer seems to be
> returned.

The following program:

void *foo() {}

compiled with egcs-1.1.1 -Wall produces:

t.cc: In function `void * foo()':
t.cc:1: warning: control reaches end of non-void function `foo()'

If you don't post a complete code snippet, we won't be able to
reproduce the problem you're reporting.

-- 
Alexandre Oliva  http://www.dcc.unicamp.br/~oliva  aoliva@{acm.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org}
Universidade Estadual de Campinas, SP, Brasil




More information about the Gcc-bugs mailing list