diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5ddc8b555b7..87e8c05ef1d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,17 @@ +2008-03-26 Douglas Gregor + + * pt.c (coerce_template_template_parm): Moved the body of the loop + of coerce_template_template_parms here, to make iteration over a + template argument pack simpler. + Also, allow matching of a template parameter pack in the template + template parameter to a template parameter in the template + template argument. + (coerce_template_template_parms): Deal with variadic template + template parameters. Use coerce_template_template_parm. + (unify): Make sure we coerce the template template argument's + template arguments to the template template parameter's template + parameters, not the other way around. + 2008-03-25 Tom Tromey * Make-lang.in: Remove .o targets. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index bc33efc7fbd..67d392da456 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -4630,6 +4630,77 @@ convert_nontype_argument (tree type, tree expr) return expr; } +/* Subroutine of coerce_template_template_parms, which returns 1 if + PARM_PARM and ARG_PARM match using the rule for the template + parameters of template template parameters. Both PARM and ARG are + template parameters; the rest of the arguments are the same as for + coerce_template_template_parms. + */ +static int +coerce_template_template_parm (tree parm, + tree arg, + tsubst_flags_t complain, + tree in_decl, + tree outer_args) +{ + if (arg == NULL_TREE || arg == error_mark_node + || parm == NULL_TREE || parm == error_mark_node) + return 0; + + if (TREE_CODE (arg) != TREE_CODE (parm)) + return 0; + + switch (TREE_CODE (parm)) + { + case TEMPLATE_DECL: + /* We encounter instantiations of templates like + template