This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Deprecate "implicit int" for main() in C++
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: Jonathan Wakely <jwakely at redhat dot com>, Andrew Haley <aph at redhat dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Tue, 8 May 2018 12:39:05 +0100
- Subject: Re: [RFC] Deprecate "implicit int" for main() in C++
- References: <20180425122305.GS20930@redhat.com> <7039f928-e50b-1f75-4f71-70fda5873ab0@redhat.com> <20180425144008.GU20930@redhat.com> <1eda6680-f574-7637-42dd-4309dacb012e@redhat.com>
On 8 May 2018 at 12:35, Florian Weimer wrote:
> 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?
Sigh, you're probably right. Since GCC 8.1 any such configure tests
will get a warning (or an error with -Werror) so maybe they'll
eventually get fixed.
Jason already expressed a preference for not making the change anyway.