https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96330
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:574e7601829733d7cae20b5dc7034b876cc76b30 commit r11-7541-g574e7601829733d7cae20b5dc7034b876cc76b30 Author: Patrick Palka <ppa...@redhat.com> Date: Sat Mar 6 00:07:43 2021 -0500 c++: Fix tsubsting member variable template-id [PR96330] This makes tsubst_copy appropriately handle a variable template-id, which in turn fixes tsubsting a COMPONENT_REF whose member operand is known at parse time to be a variable template-id, as in the initialization of 'x' in the first testcase. Previously, we rejected this testcase with the error "foo_t::bar<T> is not a function template", issued from lookup_template_fuction. We were already properly handling the analagous case where the object operand of the COMPONENT_REF is dependent (and so the member operand is a dependent template name), but there doesn't seems to be existing test coverage for this, hence the second testcase below. gcc/cp/ChangeLog: PR c++/96330 * pt.c (tsubst_copy) <case TEMPLATE_ID_EXPR>: Rename local variable 'fn' to 'tmpl'. Handle a variable template-id by calling lookup_template_variable. gcc/testsuite/ChangeLog: PR c++/96330 * g++.dg/cpp1y/var-templ68.C: New test. * g++.dg/cpp1y/var-templ68a.C: New test. Co-authored-by: Jakub Jelinek <ja...@redhat.com>