aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/constraint.cc
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2022-10-25 14:14:29 -0400
committerPatrick Palka <ppalka@redhat.com>2022-10-25 14:14:29 -0400
commitfe1e1ae0c84d3f52f62509d164bbb117c29d9675 (patch)
treeb85991cffd97f77493ac11a38a9ae2ea2e42f607 /gcc/cp/constraint.cc
parent4a54873d7753068fe64e01efd5d8a06615bdb167 (diff)
downloadgcc-fe1e1ae0c84d3f52f62509d164bbb117c29d9675.zip
gcc-fe1e1ae0c84d3f52f62509d164bbb117c29d9675.tar.gz
gcc-fe1e1ae0c84d3f52f62509d164bbb117c29d9675.tar.bz2
c++: remove use_default_args parm of coerce_template_parms
The parameter use_default_args of coerce_template_parms, introduced way back in r110693, is effectively unused ever since r7-5536-g3c75aaa3d884ef removed the last 'coerce_template_parms (..., true, false)' call. So this patch aims to simplify this function's API by getting rid of this parameter. In passing, I noticed we currently define wrapper overloads of coerce_template_parms that act as defacto default arguments for complain and require_all_args. It seems cleaner however to just specify real default arguments for the main overload instead. And I suppose we should also give c_innermost_t_p the same defaults. But I'm not sure about defaulting complain to tf_none, which is inconsistent with how we default it in other places to either tf_error or tf_warning_or_error (as a convenience for non-SFINAE callers). And since in general it's probably better to not default complain as that's a source of SFINAE bugs, and only a handful of callers use this defacto complain=tf_none default, this patch gets rid of this complain default (but keeps the require_all_args default). gcc/cp/ChangeLog: * constraint.cc (resolve_function_concept_overload): Explicitly pass complain=tf_none to coerce_template_parms. (resolve_concept_check): Likewise. (normalize_concept_check): Likewise. * cp-tree.h (coerce_template_parms): Declare the main overload and default its last parameter to true. Remove wrapper overloads. * pt.cc (determine_specialization): Adjust calls to coerce_template_parms and coerce_innermost_template_parms after removing their last parameter. (coerce_template_args_for_ttp): Likewise. (coerce_ttp_args_for_tta): Likewise. (coerce_template_template_parms): Likewise. (coerce_template_parms): Remove use_default_args parameter and adjust function comment. Document default argument. Remove wrapper overloads. No longer static. (coerce_innermost_template_parms): Remove use_default_args parameter. Default require_all_args to true. (lookup_template_class): As with determine_specialization. (finish_template_variable): Likewise. (tsubst_decl): Likewise. (instantiate_alias_template): Likewise. (fn_type_unification): Likewise. (resolve_overloaded_unification): Likewise. (resolve_nondeduced_context): Likewise. (get_partial_spec_bindings): Likewise.
Diffstat (limited to 'gcc/cp/constraint.cc')
-rw-r--r--gcc/cp/constraint.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
index 74898ca..5e6a3bc 100644
--- a/gcc/cp/constraint.cc
+++ b/gcc/cp/constraint.cc
@@ -323,7 +323,7 @@ resolve_function_concept_overload (tree ovl, tree args)
/* Remember the candidate if we can deduce a substitution. */
++processing_template_decl;
tree parms = TREE_VALUE (DECL_TEMPLATE_PARMS (tmpl));
- if (tree subst = coerce_template_parms (parms, args, tmpl))
+ if (tree subst = coerce_template_parms (parms, args, tmpl, tf_none))
{
if (subst == error_mark_node)
++nerrs;
@@ -404,7 +404,7 @@ resolve_concept_check (tree check)
tree args = TREE_OPERAND (id, 1);
tree parms = INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (tmpl));
++processing_template_decl;
- tree result = coerce_template_parms (parms, args, tmpl);
+ tree result = coerce_template_parms (parms, args, tmpl, tf_none);
--processing_template_decl;
if (result == error_mark_node)
return error_mark_node;
@@ -726,7 +726,7 @@ normalize_concept_check (tree check, tree args, norm_info info)
/* Turn on template processing; coercing non-type template arguments
will automatically assume they're non-dependent. */
++processing_template_decl;
- tree subst = coerce_template_parms (parms, targs, tmpl);
+ tree subst = coerce_template_parms (parms, targs, tmpl, tf_none);
--processing_template_decl;
if (subst == error_mark_node)
return error_mark_node;