]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: passing partially inst tmpl as ttp [PR110566]
authorPatrick Palka <ppalka@redhat.com>
Wed, 26 Jul 2023 21:21:26 +0000 (17:21 -0400)
committerPatrick Palka <ppalka@redhat.com>
Wed, 26 Jul 2023 21:21:26 +0000 (17:21 -0400)
commitb3adcc60dcf3314f47f5409aecef40607f82b80b
tree5e657441ad4de0ed09da06f7067d2e032d4f6ef9
parent74290c664d1d4c067a996253fe505555ec671668
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.
gcc/cp/pt.cc
gcc/testsuite/g++.dg/template/ttp38.C [new file with mode: 0644]