https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105223
--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> --- The implicitly declared ServiceReference<int>::operator= members lack a TEMPLATE_INFO, but filter_memfn_lookup expects it (along with all other non-template member functions from the instantiated class) to have one. Not sure what the best solution here is, but we can at least work around this by making filter_memfn_lookup tolerate missing TEMPLATE_INFO in this case: gcc/cp/pt.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 78519562953..f359e596846 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -16404,6 +16404,13 @@ filter_memfn_lookup (tree oldfns, tree newfns, tree newtype) look in the old lookup set for the TEMPLATE_DECL from which it was specialized. */ return visible_set.contains (DECL_TI_TEMPLATE (fn)); + else if (!DECL_TEMPLATE_INFO (fn)) + { + /* FN is an implicitly declared special member function and thus + could not have been in the old lookup set. */ + gcc_checking_assert (DECL_ARTIFICIAL (fn) && DECL_DEFAULTED_FN (fn)); + return false; + } else /* FN is a non-template member function from the current class; look in the old lookup set for the FUNCTION_DECL from which