aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.cc
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2024-09-04 13:43:52 -0400
committerMarek Polacek <polacek@redhat.com>2024-09-04 13:44:05 -0400
commitdedf453477aa966493541a484b2d4ee5a17e5b61 (patch)
tree341860e781ca8bf25476d304047c29c82e08de42 /gcc/cp/pt.cc
parentc755c7a32590e2eef5a8b062b9756c1513910246 (diff)
downloadgcc-dedf453477aa966493541a484b2d4ee5a17e5b61.zip
gcc-dedf453477aa966493541a484b2d4ee5a17e5b61.tar.gz
gcc-dedf453477aa966493541a484b2d4ee5a17e5b61.tar.bz2
c++: cleanup coerce_template_template_parm
This function could use some sprucing up. gcc/cp/ChangeLog: * pt.cc (coerce_template_template_parm): Return bool instead of int.
Diffstat (limited to 'gcc/cp/pt.cc')
-rw-r--r--gcc/cp/pt.cc35
1 files changed, 16 insertions, 19 deletions
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 747e627..1225c66 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -7887,25 +7887,22 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
return convert_from_reference (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)
+/* Subroutine of coerce_template_template_parms, which returns true if
+ PARM and ARG 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 bool
+coerce_template_template_parm (tree parm, tree arg, tsubst_flags_t complain,
+ tree in_decl, tree outer_args)
{
if (arg == NULL_TREE || error_operand_p (arg)
|| parm == NULL_TREE || error_operand_p (parm))
- return 0;
+ return false;
if (TREE_CODE (arg) != TREE_CODE (parm))
- return 0;
+ return false;
switch (TREE_CODE (parm))
{
@@ -7916,7 +7913,7 @@ coerce_template_template_parm (tree parm,
{
if (!coerce_template_template_parms
(parm, arg, complain, in_decl, outer_args))
- return 0;
+ return false;
}
/* Fall through. */
@@ -7924,7 +7921,7 @@ coerce_template_template_parm (tree parm,
if (TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (arg))
&& !TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (parm)))
/* Argument is a parameter pack but parameter is not. */
- return 0;
+ return false;
break;
case PARM_DECL:
@@ -7940,13 +7937,13 @@ coerce_template_template_parm (tree parm,
tree t = tsubst (TREE_TYPE (parm), outer_args, complain, in_decl);
if (!uses_template_parms (t)
&& !same_type_p (t, TREE_TYPE (arg)))
- return 0;
+ return false;
}
if (TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (arg))
&& !TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (parm)))
/* Argument is a parameter pack but parameter is not. */
- return 0;
+ return false;
break;
@@ -7954,7 +7951,7 @@ coerce_template_template_parm (tree parm,
gcc_unreachable ();
}
- return 1;
+ return true;
}
/* Coerce template argument list ARGLIST for use with template