From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.2.16-22smp i686)
g++ detects when non-void functions do not have a return statement.
However, for some reason it does not detect when int main() does not return
Steps to Reproduce:
// g++ detects lack of return statement here
int main ()
// but doesn't detect it here
Actual Results: y.cpp: In function `int foo ()':
y.cpp:4: warning: no return statement in function returning non-void
Expected Results: I would expect to get for main the same warning that I
got for foo.
No, this is correct. ISO C++ [basic.start.main]/5 sais that:
If control reached the end of main without encountering a return statement,
the effect is that of executing
For functions other than main, the standard requires non-void functions
to end with return statement.