https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105623
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:850a9ce8bcca59c7efabcdeeca14c5bd905e8363 commit r13-768-g850a9ce8bcca59c7efabcdeeca14c5bd905e8363 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.