[RFC] Deprecate "implicit int" for main() in C++

Florian Weimer fweimer@redhat.com
Tue May 8 11:36:00 GMT 2018


On 04/25/2018 04:40 PM, Jonathan Wakely wrote:
> More concretely, deprecating it for a few releases would allow us to
> apply the attached patch at some point in the future, so that instead
> of:
> 
> rt.c:1:6: warning: ISO C++ forbids declaration of ‘main’ with no type 
> [-Wreturn-type]
> main() { return 0; }
>       ^
> 
> We'd get:
> 
> rt.c:1:6: error: ISO C++ forbids declaration of 'main' with no type 
> [-fpermissive]
> main() { return 0; }
>       ^

I wonder if it's currently a warning because the implicit int is used in 
configure checks.  If this is the case, maybe we cannot make it an error 
without altering the result of configure tests?

Thanks,
Florian



More information about the Gcc mailing list