From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6A0A33857C54; Mon, 13 Jul 2020 12:24:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A0A33857C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1594643089; bh=XQmKH3Mv45qoVcwLovpPD6nf0ldzAlL5vUKn4QmUTCA=; h=From:To:Subject:Date:From; b=XeVZ39FdEwGh2LGwZ8b5eg2TSeDyC8kg0ftA3cADuM8LfJAPyjJGjDhKMSZ/shGv8 E/SvTEG24BAPbzCWbr5nKJhwyKKGzM/Goc+RL5NFgqKnBQ+mEeoeYEbdqPQyJa0W8e cuRBHWHXfV3QzDiWdsTKb7YdVhNs+vWm2k4SRkJ0= From: "haoxintu at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96183] New: GCC accepts "convert '' from 'void' to 'int'" at compile time Date: Mon, 13 Jul 2020 12:24:49 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: haoxintu at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jul 2020 12:24:49 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96183 Bug ID: 96183 Summary: GCC accepts "convert '' from 'void' to 'int'" at compile time Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: accepts-invalid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: haoxintu at gmail dot com Target Milestone: --- Hi,all. This code, test.cc, is an invalid code but GCC accepts it. $cat test.cc void=20 foo ( auto,=20 int var =3D throw ) {} $g++ test.cc test.cc:3:5: warning: use of =E2=80=98auto=E2=80=99 in parameter declaratio= n only available with =E2=80=98-fconcepts-ts=E2=80=99 3 | auto, | ^~~~ When I add -fconcepts-ts, GCC accepts this without any diagnostic message. While in clang $clang++ -c test.cc test.cc:3:5: error: 'auto' not allowed in function prototype auto,=20 ^~~~ test.cc:4:9: error: cannot initialize a parameter of type 'int' with an rva= lue of type 'void' int var =3D throw ) ^ ~~~~~ test.cc:4:9: note: passing argument to parameter 'var' here 2 errors generated. The first error is ok because GCC emits an warning. I know when call foo() = will trigger the runtime error. But should GCC emit the error message like the second error in clang at compile time? Or is this a intentional way when GCC dealing with "auto" in function prototype? Every GCC versions from 6.1 to trunk behave the same. Thanks, Haoxin=