https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93085
--- Comment #6 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:84081e2c6bd43a6790f751755865cf4227adac7c commit r11-8137-g84081e2c6bd43a6790f751755865cf4227adac7c Author: Jason Merrill <ja...@redhat.com> Date: Sat Apr 10 02:10:32 2021 -0400 c++: premature overload resolution [PR93085] We can't resolve the call to foo<42> before instantiation of G, because the template parameter of #1 has dependent type. But we were missing that in our dependency check, because the tree walk of DECL_TEMPLATE_PARMS doesn't look into the types of template parameters. So look at them directly. gcc/cp/ChangeLog: PR c++/93085 * pt.c (uses_outer_template_parms): Handle non-type and template template parameters specifically. gcc/testsuite/ChangeLog: PR c++/93085 * g++.dg/template/dependent-tmpl1.C: New test.