aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2021-06-10 18:31:21 -0400
committerPatrick Palka <ppalka@redhat.com>2021-06-10 18:31:21 -0400
commitedec2660ff4890ecf8cc191f7c92cf527de51fe2 (patch)
tree697cc07ce68ac9aba7e9d0d61cd12db9662b2860 /gcc/cp
parent206db06ee380f490db0293af4ea7a4d590abd78c (diff)
downloadgcc-edec2660ff4890ecf8cc191f7c92cf527de51fe2.zip
gcc-edec2660ff4890ecf8cc191f7c92cf527de51fe2.tar.gz
gcc-edec2660ff4890ecf8cc191f7c92cf527de51fe2.tar.bz2
c++: matching deduced template template parameters [PR67829]
During deduction, when the template of the argument for a bound ttp is a template template parameter, we need to consider the TEMPLATE_TEMPLATE_PARAMETER for matching rather than the TEMPLATE_DECL thereof, because the canonical form of a template template parameter as a template argument is the former tree, not the latter. PR c++/67829 gcc/cp/ChangeLog: * pt.c (unify) <case BOUND_TEMPLATE_TEMPLATE_PARM>: When the TEMPLATE_DECL of a BOUND_TEMPLATE_TEMPLATE_PARM argument is a template template parameter, adjust to the TEMPLATE_TEMPLATE_PARAMETER before falling through. gcc/testsuite/ChangeLog: * g++.dg/template/ttp34.C: New test. * g++.dg/template/ttp34a.C: New test. * g++.dg/template/ttp34b.C: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/pt.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index b0155a9..d87382d 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -23555,6 +23555,10 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict,
return 1;
arg = TYPE_TI_TEMPLATE (arg);
+ if (DECL_TEMPLATE_TEMPLATE_PARM_P (arg))
+ /* If the template is a template template parameter, use the
+ TEMPLATE_TEMPLATE_PARM for matching. */
+ arg = TREE_TYPE (arg);
/* Fall through to deduce template name. */
}