From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 46C823856DC6; Tue, 3 May 2022 14:24:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 46C823856DC6 From: "ppalka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105351] [concepts] Constraint checking does correctly match static member attributes Date: Tue, 03 May 2022 14:24:56 +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.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ppalka at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ppalka at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status everconfirmed cf_reconfirmed_on assigned_to 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: Tue, 03 May 2022 14:24:56 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105351 Patrick Palka changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Ever confirmed|0 |1 Last reconfirmed| |2022-05-03 Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot g= nu.org --- Comment #6 from Patrick Palka --- Er, the real reason the above works is because the type auto* of dummy's template parameter demands that the argument &T::attr2 is an ordinary point= er, not a pointer to member, which implies that it's a static member. We should also be able to check that attr2 is a static member via template struct dummy; template concept C =3D requires(T v) { v.attr1; typename dummy; v.fun1(); T::fun2(); }; which Clang is happy with, but GCC incorrectly emits an error during SFINAE: : In substitution of 'template requires C a= uto f(auto:1) [with auto:1 =3D Z]': :48:5: required from here :9:14: error: invalid use of non-static data member 'Z::attr2' 9 | typename dummy; | ~~~~~~~~~^~~~~~~~~~~~~~~~ :39:15: note: declared here 39 | const int attr2 =3D 0; | ^~~~~ This is definitely a bug.=