From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DF9ED384780A; Fri, 9 Apr 2021 22:36:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF9ED384780A From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/99374] [8/9/10 Regression] C++17/20 mode fails to recognise pointer-to-member functions of incomplete types in conditional expression Date: Fri, 09 Apr 2021 22:36:50 +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: 10.2.1 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org X-Bugzilla-Target-Milestone: 8.5 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: Fri, 09 Apr 2021 22:36:51 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99374 --- Comment #7 from CVS Commits --- The releases/gcc-10 branch has been updated by Marek Polacek : https://gcc.gnu.org/g:6fcf6e5977541b2383760cb4e15ff0403055b13a commit r10-9685-g6fcf6e5977541b2383760cb4e15ff0403055b13a Author: Marek Polacek Date: Thu Mar 4 14:25:01 2021 -0500 c++: Pointer-to-member fn conversion with noexcept [PR99374] The issue in this PR is that we wrongly reject converting pointers to member function of incomplete types, one of which has noexcept. Recall that pointers (including pointers to member functions) to non-throwing functions can be implicitly converted to potentially-throwing functions (but not vice versa). We reject the conversion when called from can_convert_arg_bad because standard_conversion can't create such a conversion. It comes down to the DERIVED_FROM_P check in the TYPE_PTRMEMFUNC_P block. It considers every class derived from itself, but not when the class is incomplete. But surely we want to reach fnptr_conv_p when tbase is fbase (one of them could be an alias to the other so use same_type_p instead of =3D= =3D). Another approach would be to not perform DERIVED_FROM_P at all when either tbase or fbase are incomplete (so perhaps something like at the end of ptr_reasonably_similar). gcc/cp/ChangeLog: PR c++/99374 * call.c (standard_conversion): When converting pointers to member, don't return NULL when the bases are equivalent but incomplete. gcc/testsuite/ChangeLog: PR c++/99374 * g++.dg/cpp1z/noexcept-type23.C: New test. (cherry picked from commit 02a3554879001e8f1405d17e096ed68fc3f76975)=