https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93740
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:c822ad86984e752734b9c371f9cfef9330334ec4 commit r14-6519-gc822ad86984e752734b9c371f9cfef9330334ec4 Author: Patrick Palka <ppa...@redhat.com> Date: Wed Dec 13 15:55:01 2023 -0500 c++: unifying FUNCTION_DECLs [PR93740] unify currently always returns success when unifying two FUNCTION_DECLs (due to the is_overloaded_fn deferment within the default case), which means for the below testcase we incorrectly unify &A::foo and &A::bar leading to deduction failure for the index_of calls due to a bogus base class ambiguity. This patch makes unify handle FUNCTION_DECL naturally like other decls. PR c++/93740 gcc/cp/ChangeLog: * pt.cc (unify) <case FUNCTION_DECL>: Handle it like FIELD_DECL and TEMPLATE_DECL. gcc/testsuite/ChangeLog: * g++.dg/template/ptrmem34.C: New test.