From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0077E3858D39; Tue, 20 Sep 2022 10:15:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0077E3858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663668907; bh=aLlMrz/v/Up4ZzpI9bv17BSou8Hy6kveTjdDgz3dXpM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=M9szf6f3jS/xpdw7vyFHOjnJVSFSnxLs092tDqotvqeJSfWwm3anpCYxsGPsDi3DN EHShzITPMlRhw4efwqxdpnNAVGDUV1Dovb9g6ahjezimAsCmms2jxzp4VaudTWVDd1 o0oTOB+6BDxx6Qw4EUVxiAGbJh0c1cQPTq3l5ABw= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/99546] Weird return value of C++20 requires expression Date: Tue, 20 Sep 2022 10:15:06 +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: wrong-code 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 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99546 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed|2021-08-16 00:00:00 |2022-9-20 --- Comment #6 from Jonathan Wakely --- (In reply to =E5=BA=B7=E6=A1=93=E7=91=8B from comment #1) > You can see more weird cases in this:=20 > https://stackoverflow.com/questions/66578966/weird-return-value-of-c20- > requires-expression. Copying that here instead of linking to impermanent SO comments: template void foo() { static_assert(b); } int main() { constexpr bool b =3D requires { []{}; }; foo(); foo(); } The bool appears to not be a constant expression: x.C: In function 'int main()': x.C:8:10: error: no matching function for call to 'foo<(!(bool)b)>()' 8 | foo(); | ~~~~~~~^~ x.C:2:6: note: candidate: 'template void foo()' 2 | void foo() { | ^~~ x.C:2:6: note: template argument deduction/substitution failed: x.C:9:9: error: no matching function for call to 'foo()' 9 | foo(); | ~~~~~~^~ x.C:2:6: note: candidate: 'template void foo()' 2 | void foo() { | ^~~ x.C:2:6: note: template argument deduction/substitution failed:=