https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95036
--- 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:2c3309e3d0f5cb8f298f7604848d115f0992e04f commit r12-7236-g2c3309e3d0f5cb8f298f7604848d115f0992e04f Author: Jason Merrill <ja...@redhat.com> Date: Thu Feb 10 17:57:38 2022 -0500 c++: TTP in member alias template [PR104107] In the first testcase, coerce_template_template_parms was adding too much of outer_args when coercing to match P's template parameters, so that when substituting into the 'const T&' parameter we got an unrelated template argument for T. We should only add outer_args when the argument template is a nested template. PR c++/104107 PR c++/95036 gcc/cp/ChangeLog: * pt.cc (coerce_template_template_parms): Take full parms. Avoid adding too much of outer_args. (coerce_template_template_parm): Adjust. (template_template_parm_bindings_ok_p): Adjust. (convert_template_argument): Adjust. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/alias-decl-ttp2.C: New test. * g++.dg/cpp1z/ttp2.C: New test.