c++: premature overload resolution [PR93085]
authorJason Merrill <jason@redhat.com>
Sat, 10 Apr 2021 06:10:32 +0000 (02:10 -0400)
committerJason Merrill <jason@redhat.com>
Mon, 12 Apr 2021 21:29:54 +0000 (17:29 -0400)
commit84081e2c6bd43a6790f751755865cf4227adac7c
treebea64490c946c310635dd1caeeae33e28a3a7632
parent7650259de8f86c403113f7186d82737eddb65ef6
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.
gcc/cp/pt.c
gcc/testsuite/g++.dg/template/dependent-tmpl1.C [new file with mode: 0644]