aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-threadbackward.c
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2021-09-27 16:01:10 -0400
committerPatrick Palka <ppalka@redhat.com>2021-09-27 16:01:10 -0400
commit51018dd1395c72b3681ae5f84eceb94320472922 (patch)
tree7715eb2e871b7c6b827dd40b6c66728e489942aa /gcc/tree-ssa-threadbackward.c
parent83668368607ac70dcce466a54673bbf88d0ab2da (diff)
downloadgcc-51018dd1395c72b3681ae5f84eceb94320472922.zip
gcc-51018dd1395c72b3681ae5f84eceb94320472922.tar.gz
gcc-51018dd1395c72b3681ae5f84eceb94320472922.tar.bz2
c++: deduction guides and ttp rewriting [PR102479]
The problem here is ultimately that rewrite_tparm_list when rewriting a TEMPLATE_TEMPLATE_PARM introduces a tree cycle in the rewritten ttp that structural_comptypes can't cope with. In particular the DECL_TEMPLATE_PARMS of a ttp's TEMPLATE_DECL normally captures an empty parameter list at its own level (and so the TEMPLATE_DECL doesn't appear in its own DECL_TEMPLATE_PARMS), but rewrite_tparm_list ends up giving it a complete parameter list. In the new testcase below, this causes infinite recursion from structural_comptypes when comparing Tmpl<char> with Tmpl<long> (where both 'Tmpl's are rewritten ttps). This patch fixes this by making rewrite_template_parm give a rewritten template template parm an empty parameter list at its own level, thereby avoiding the tree cycle. Testing the alias CTAD case revealed that we're not setting current_template_parms in alias_ctad_tweaks, which this patch also fixes. PR c++/102479 gcc/cp/ChangeLog: * pt.c (rewrite_template_parm): Handle single-level tsubst_args. Avoid a tree cycle when assigning the DECL_TEMPLATE_PARMS for a rewritten ttp. (alias_ctad_tweaks): Set current_template_parms accordingly. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/class-deduction12.C: Also test alias CTAD in the same way. * g++.dg/cpp1z/class-deduction99.C: New test.
Diffstat (limited to 'gcc/tree-ssa-threadbackward.c')
0 files changed, 0 insertions, 0 deletions