From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5EF1A3853813; Thu, 22 Jul 2021 14:02:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5EF1A3853813 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96183] GCC accepts "convert '' from 'void' to 'int'" at compile time Date: Thu, 22 Jul 2021 14:02:27 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: NEW 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: cf_reconfirmed_on bug_status keywords everconfirmed Message-ID: In-Reply-To: References: 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: Thu, 22 Jul 2021 14:02:27 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96183 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2021-07-22 Status|UNCONFIRMED |NEW Keywords|accepts-invalid |diagnostic Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely --- The 'auto' parameter makes this a function template, and you never instanti= ate the template. Compilers are not required to diagnose errors in uninstantiat= ed templates. If you call it, you get the expected error: void=20 foo (auto, int var =3D throw ) {} int main() { foo(1); } 96183.C: In function =E2=80=98void foo(auto:1, int) [with auto:1 =3D int]= =E2=80=99: 96183.C:3:15: error: could not convert =E2=80=98=E2=80=99= from =E2=80=98void=E2=80=99 to =E2=80=98int=E2=80=99 3 | int var =3D throw ) | ^~~~~ | | | void 96183.C:8:6: note: when instantiating default argument for call to =E2=80= =98void foo(auto:1, int) [with auto:1 =3D int]=E2=80=99 8 | foo(1); | ~~~^~~ 96183.C: In function =E2=80=98int main()=E2=80=99: 96183.C:8:6: error: void value not ignored as it ought to be The second error seems bogus though. Confirming as a diagnostic bug, but it's not accepts-invalid.=