From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6F5C038708F5; Fri, 30 Jun 2023 13:44:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6F5C038708F5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688132676; bh=BPSYI1Z+Z1P/8c8j0bzTszecrif+WvnVicOaHiOygzk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=s7b5NmpFU8AjQ50Tm0bntzD394KU6i7ARU+fkja+ZVOL6wEMRjXCIRNZ0PEkbeOBQ SJ7M7FqwWQ4ki+LCRRc43Ay10wglyzKJjnSOvM/HlGTOYLJZxCCuHRMJVHMuMjaMZe hg+We0tu0rjY6tbWYKBDxeejS5nL2Sjgm51ZtsP0= From: "ppalka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/110497] Wrong error on non-static data member referenced in concept definition Date: Fri, 30 Jun 2023 13:44:35 +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: 13.1.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: ppalka 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: blocked cc 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=3D110497 Patrick Palka changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |67491 CC| |ppalka at gcc dot gnu.org --- Comment #1 from Patrick Palka --- It seems we're issuing a hard error during satisfaction here because substitution failure didn't occur, and the substituted constraint is non-constant which renders the program ill-formed as per [temp.constr.atomic]/3: > If substitution results in an invalid type or expression, the constraint = is not satisfied. Otherwise, the lvalue-to-rvalue conversion is performed i= f necessary, and E shall be a constant expression of type bool. One might argue substitution failure should occur for T::b with T=3DB, but = this seems to be permitted by [expr.prim.id.general]/3 since constraint-expressi= ons are unevaluated contexts. Note that if we use B::b directly in the concept definition then Clang also rejects the program due to non-constant satisfaction rule: struct B { const bool b =3D true; }; template concept C =3D B::b; static_assert( !C ); error: substitution into constraint expression resulted in a non-constant expression So GCC might be correct to reject the original program. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D67491 [Bug 67491] [meta-bug] concepts issues=