https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110566
--- 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:b3adcc60dcf3314f47f5409aecef40607f82b80b commit r14-2809-gb3adcc60dcf3314f47f5409aecef40607f82b80b Author: Patrick Palka <ppa...@redhat.com> Date: Wed Jul 26 17:21:26 2023 -0400 c++: passing partially inst tmpl as ttp [PR110566] Since the template arguments 'pargs' we pass to coerce_template_parms from coerce_template_template_parms are always a full set, we need to make sure we always pass the parameters of the most general template because if the template is partially instantiated then the levels won't match up. In the testcase below during said call to coerce_template_parms the parameters are {X, Y}, both level 1 rather than 2, and the arguments are {{int}, {N, M}}, which results in a crash during auto deduction for parameters' types. PR c++/110566 PR c++/108179 gcc/cp/ChangeLog: * pt.cc (coerce_template_template_parms): Simplify by using DECL_INNERMOST_TEMPLATE_PARMS and removing redundant asserts. Always pass the parameters of the most general template to coerce_template_parms. gcc/testsuite/ChangeLog: * g++.dg/template/ttp38.C: New test.