https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105623
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-12 branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:d90576952356735a2152c318ef1d60221b958b15 commit r12-8441-gd90576952356735a2152c318ef1d60221b958b15 Author: Jason Merrill <ja...@redhat.com> Date: Tue May 24 17:37:58 2022 -0400 c++: deduction from auto fn [PR105623] Since my patch for PR90451, we defer mark_used of single functions as late as possible. And since my r12-1273, we keep BASELINK from lookup around rather than reconstruct it later. These both made us try to instantiate g with a function type that still had 'auto' as its return type. PR c++/105623 gcc/cp/ChangeLog: * decl2.cc (mark_used): Copy type from fn to BASELINK. * pt.cc (unify_one_argument): Call mark_single_function. gcc/testsuite/ChangeLog: * g++.dg/cpp1y/auto-fn62.C: New test.