From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C2DF83840C03; Mon, 22 Jun 2020 03:48:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C2DF83840C03 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1592797732; bh=KJIfQdT3aPkSGEi/MX8iOaDYZtAMLNutD1jDltsifWo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=OH23yStbBCp5KAKMEocDa4uVsaQxFCF93KbVAdE3kIqUBKpmlR/ucdodGm7m/KHFD 5MUnG/V0Nc3f5uVgvMMz7kaFhaaYdjbAHG20p8P5Hz9Wt2CGu5JwKAlgEX/oxwSmJT oacIQwbX5HL3MsNUYD2A1sdKZOmC0pqfMWF0SL9o= From: "haoxintu at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95807] GCC accepts "void value not ignored as it ought to be" in function template Date: Mon, 22 Jun 2020 03:48:52 +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: 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: 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: Mon, 22 Jun 2020 03:48:52 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95807 --- Comment #2 from Haoxin Tu --- (In reply to Andrew Pinski from comment #1) > I think it is rejected at instanition time. Hi, Andrew. Shouldn't it be rejected at compiling time? Please take a look at another case, test.cc $cat test.cc void foo1(int var =3D throw) {}; template =20 void foo2(int var =3D throw){ }; $g++ -c test.cc test.cc:1:21: error: could not convert =E2=80=98=E2=80=99= from =E2=80=98void=E2=80=99 to =E2=80=98int=E2=80=99 1 | void foo1(int var =3D throw){ }; | ^~~~~ | | | void $clang++ -c test.c test.cc:1:15: error: cannot initialize a parameter of type 'int' with an rv= alue of type 'void' void foo1(int var =3D throw){ }; ^ ~~~~~ test.cc:1:15: note: passing argument to parameter 'var' here test.cc:3:15: error: cannot initialize a parameter of type 'int' with an rv= alue of type 'void' void foo2(int var =3D throw){ }; ^ ~~~~~ test.cc:3:15: note: passing argument to parameter 'var' here 2 errors generated. Is this case similar with bug.cc? I guess an "void" can't be a rvalue at any time.=