c++: remove use_default_args parm of coerce_template_parms
authorPatrick Palka <ppalka@redhat.com>
Tue, 25 Oct 2022 18:14:29 +0000 (14:14 -0400)
committerPatrick Palka <ppalka@redhat.com>
Tue, 25 Oct 2022 18:14:29 +0000 (14:14 -0400)
commitfe1e1ae0c84d3f52f62509d164bbb117c29d9675
treeb85991cffd97f77493ac11a38a9ae2ea2e42f607
parent4a54873d7753068fe64e01efd5d8a06615bdb167
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.
gcc/cp/constraint.cc
gcc/cp/cp-tree.h
gcc/cp/pt.cc