https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86178

            Bug ID: 86178
           Summary: No warning when missing return from function main()
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jg at jguk dot org
  Target Milestone: ---

Hello, should GCC show an error when "return" is missing from function main()
below ? Maybe I am missing something...

jonny@asus:~/code$ g++ -O2 -Wreturn-type -Wall -Wextra -Wnull-dereference
-Wpedantic -o main main3.cpp
jonny@asus:~/code$ 

I expected:
In function ‘main’:
warning: control reaches end of non-void function [-Wreturn-type]



//g++-8 -O2 -Wreturn-type  -Wall -Wextra -Wnull-dereference -Wpedantic -o main
main3.cpp

#include <stdio.h>

int main(void)
{
   printf("hello\n");
   // return
}

Reply via email to