c++: remove coerce_innermost_template_parms
The only practical difference between coerce_innermost_template_parms
and the main function coerce_template_parms is that the former accepts
a potentially multi-level parameter list and returns an argument vector
of the same depth, whereas the latter accepts only a single level of
parameters and only returns only a single level of arguments. Both
functions accept a multi-level argument vector.
In light of this, it seems more natural to just overload the behavior of
the main function according to whether the given parameter list is
multi-level or not. And it turns out we can assume the given parms and
args have the same depth in the multi-level case, which simplifies the
overloading logic.
Besides the simplification benefit, another benefit of this unification
is that it avoids an extra copy of a multi-level args since now we can
return new_args directly from c_t_p. (And because of this, we need to
turn new_inner_args into a reference so that overwriting it also updates
new_args.)
gcc/cp/ChangeLog:
* pt.cc (coerce_template_parms): Salvage part of the function
comment from c_innermost_t_p. Handle parms being a full
template parameter list.
(coerce_innermost_template_parms): Remove.
(lookup_template_class): Use c_t_p instead of c_innermost_t_p.
(finish_template_variable): Likewise.
(tsubst_decl): Likewise.
(instantiate_alias_template): Likewise.