From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EDD57394003C; Wed, 12 Jan 2022 17:03:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EDD57394003C From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/103831] non-dependent call to non-static member function not rejected ahead of time when there are dependent bases and no 'this' Date: Wed, 12 Jan 2022 17:03:46 +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: 12.0 X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit 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: 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: Wed, 12 Jan 2022 17:03:47 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103831 --- Comment #4 from CVS Commits --- The releases/gcc-11 branch has been updated by Patrick Palka : https://gcc.gnu.org/g:614a9580d4463c4aefd74c40ed46bfab2bef65c7 commit r11-9456-g614a9580d4463c4aefd74c40ed46bfab2bef65c7 Author: Patrick Palka Date: Tue Jan 11 13:00:48 2022 -0500 c++: dependent bases and 'this' availability [PR103831] Here during satisfaction of B's constraints we're failing to reject the object-less call to the non-static member function A::size ultimately because satisfaction is performed in the (access) context of the class template B, which has a dependent base, and so the any_dependent_bases_p check within build_new_method_call causes us to not reject the call. (Subsequent constexpr evaluation of the call succeeds since the function is effectively static.) This patch fixes this by refining the any_dependent_bases_p check within build_new_method_call: if we're in a context where 'this' is unavailabl= e, then we cannot resolve the implicit object regardless of the presence of a dependent base. So let's also check current_class_ptr alongside a_d_= b_p. PR c++/103831 gcc/cp/ChangeLog: * call.c (build_new_method_call): Consider dependent bases only if 'this' is available. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-class3.C: New test. * g++.dg/template/non-dependent18.C: New test. (cherry picked from commit 0378f563b0321c44c4a9c98cf46d2a22b9160f76)=