aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2023-03-14 22:07:45 -0400
committerJason Merrill <jason@redhat.com>2023-03-15 08:44:42 -0400
commit5ccbf162511b896672a72934c3cafd37a42d6438 (patch)
tree110803bc400b32d51f8bda5320af4a63ef396ce1 /gcc
parent0fc541efc340535d212cd685176bd9592905de8a (diff)
downloadgcc-5ccbf162511b896672a72934c3cafd37a42d6438.zip
gcc-5ccbf162511b896672a72934c3cafd37a42d6438.tar.gz
gcc-5ccbf162511b896672a72934c3cafd37a42d6438.tar.bz2
c++: coerce_template_template_parms interface tweak
This should have no semantic effect, but is a prerequisite for the PR108179 fix to follow. PR c++/108179 gcc/cp/ChangeLog: * pt.cc (coerce_template_template_parms): Take the arg and parm templates directly. (coerce_template_template_parm): Adjust. (template_template_parm_bindings_ok_p): Adjust. (convert_template_argument): Adjust.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/pt.cc42
1 files changed, 15 insertions, 27 deletions
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 84021c2..d75c439 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -7798,11 +7798,8 @@ coerce_template_template_parm (tree parm,
template <template <template <class> class> class TT>
class C; */
{
- tree parmparm = DECL_TEMPLATE_PARMS (parm);
- tree argparm = DECL_TEMPLATE_PARMS (arg);
-
if (!coerce_template_template_parms
- (parmparm, argparm, complain, in_decl, outer_args))
+ (parm, arg, complain, in_decl, outer_args))
return 0;
}
/* Fall through. */
@@ -8050,21 +8047,19 @@ unify_bound_ttp_args (tree tparms, tree targs, tree parm, tree& arg,
return 0;
}
-/* Return 1 if PARM_PARMS and ARG_PARMS matches using rule for
- template template parameters. Both PARM_PARMS and ARG_PARMS are
- vectors of TREE_LIST nodes containing TYPE_DECL, TEMPLATE_DECL
- or PARM_DECL.
+/* Return 1 if PARM_TMPL and ARG_TMPL match using rule for
+ template template parameters.
Consider the example:
template <class T> class A;
template<template <class U> class TT> class B;
- For B<A>, PARM_PARMS are the parameters to TT, while ARG_PARMS are
- the parameters to A, and OUTER_ARGS contains A. */
+ For B<A>, PARM_TMPL is TT, while ARG_TMPL is A,
+ and OUTER_ARGS contains A. */
static int
-coerce_template_template_parms (tree parm_parms_full,
- tree arg_parms_full,
+coerce_template_template_parms (tree parm_tmpl,
+ tree arg_tmpl,
tsubst_flags_t complain,
tree in_decl,
tree outer_args)
@@ -8073,7 +8068,8 @@ coerce_template_template_parms (tree parm_parms_full,
tree parm, arg;
int variadic_p = 0;
- tree parm_parms = INNERMOST_TEMPLATE_PARMS (parm_parms_full);
+ tree parm_parms = INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (parm_tmpl));
+ tree arg_parms_full = DECL_TEMPLATE_PARMS (arg_tmpl);
tree arg_parms = INNERMOST_TEMPLATE_PARMS (arg_parms_full);
gcc_assert (TREE_CODE (parm_parms) == TREE_VEC);
@@ -8254,8 +8250,6 @@ template_template_parm_bindings_ok_p (tree tparms, tree targs)
for (idx = 0; idx < len; ++idx)
{
- tree targ_parms = NULL_TREE;
-
if (packed_args)
/* Extract the next argument from the argument
pack. */
@@ -8267,18 +8261,16 @@ template_template_parm_bindings_ok_p (tree tparms, tree targs)
/* Extract the template parameters from the template
argument. */
- if (TREE_CODE (targ) == TEMPLATE_DECL)
- targ_parms = DECL_TEMPLATE_PARMS (targ);
- else if (TREE_CODE (targ) == TEMPLATE_TEMPLATE_PARM)
- targ_parms = DECL_TEMPLATE_PARMS (TYPE_NAME (targ));
+ if (TREE_CODE (targ) == TEMPLATE_TEMPLATE_PARM)
+ targ = TYPE_NAME (targ);
/* Verify that we can coerce the template template
parameters from the template argument to the template
parameter. This requires an exact match. */
- if (targ_parms
+ if (TREE_CODE (targ) == TEMPLATE_DECL
&& !coerce_template_template_parms
- (DECL_TEMPLATE_PARMS (tparm),
- targ_parms,
+ (tparm,
+ targ,
tf_none,
tparm,
targs))
@@ -8571,15 +8563,11 @@ convert_template_argument (tree parm,
val = orig_arg;
else
{
- tree parmparm = DECL_TEMPLATE_PARMS (parm);
- tree argparm;
-
/* Strip alias templates that are equivalent to another
template. */
arg = get_underlying_template (arg);
- argparm = DECL_TEMPLATE_PARMS (arg);
- if (coerce_template_template_parms (parmparm, argparm,
+ if (coerce_template_template_parms (parm, arg,
complain, in_decl,
args))
{