* call.c (build_user_type_conversion_1): Use OVL_FIRST.
(print_error_for_call_faulure): Use OVL_NAME.
(build_op_call_1): Use ovl_iterator.
(add_candidates): Use OVL_FIRST & lkp_iterator.
(build_op_delete_call): Use MAYBE_BASELINK_FUNCTIONS &
lkp_iterator.
* class.c (deduce_noexcept_on_destructors): Use ovl_iterator.
(type_has_user_nondefault_constructor)
in_class_defaulted_default_constructor,
type_has_user_provided_constructor,
type_has_user_provided_or_explicit_constructor,
type_has_non_user_provided_default_constructor,
vbase_has_user_provided_move_assign,
type_has_move_constructor, type_has_move_assign,
type_has_user_declared_move_constructor,
type_has_user_declared_move_assign,
type_build_ctor_call, type_build_dtor_call,
type_requires_array_cookie, explain_non_literal_class): Likewise.
(finish_struct): Use lkp_iterator.
(resolve_address_of_overloaded_function): Use OVL_NAME,
lkp_iterator.
(note_name_declared_in_class): Use OVL_NAME.
* cxx-pretty-print.c (pp_cxx_unqualified_id): Use OVL_FIRST.
(pp_cxx_qualified_id, cxx_pretty_printer::id_expression)
cxx_pretty_printer::expression): Likewise.
* decl2.c (check_classfn): Use ovl_iterator.
* pt.c (retrieve_specialization): Use ovl_iterator.
* tree.c (cp_tree_equal): Use lkp_iterator.
(type_has_nontrivial_copy_init): Use ovl_iterator.
((--This line, and those below, will be ignored--
M cp/ChangeLog
M cp/call.c
M cp/class.c
M cp/pt.c
M cp/decl2.c
M cp/tree.c
M cp/cxx-pretty-print.c
From-SVN: r248120
2017-05-16 Nathan Sidwell <nathan@acm.org>
+ * call.c (build_user_type_conversion_1): Use OVL_FIRST.
+ (print_error_for_call_faulure): Use OVL_NAME.
+ (build_op_call_1): Use ovl_iterator.
+ (add_candidates): Use OVL_FIRST & lkp_iterator.
+ (build_op_delete_call): Use MAYBE_BASELINK_FUNCTIONS &
+ lkp_iterator.
+ * class.c (deduce_noexcept_on_destructors): Use ovl_iterator.
+ (type_has_user_nondefault_constructor,
+ in_class_defaulted_default_constructor,
+ type_has_user_provided_constructor,
+ type_has_user_provided_or_explicit_constructor,
+ type_has_non_user_provided_default_constructor,
+ vbase_has_user_provided_move_assign,
+ type_has_move_constructor, type_has_move_assign,
+ type_has_user_declared_move_constructor,
+ type_has_user_declared_move_assign,
+ type_build_ctor_call, type_build_dtor_call,
+ type_requires_array_cookie, explain_non_literal_class): Likewise.
+ (finish_struct): Use lkp_iterator.
+ (resolve_address_of_overloaded_function): Use OVL_NAME, lkp_iterator.
+ (note_name_declared_in_class): Use OVL_NAME.
+ * cxx-pretty-print.c (pp_cxx_unqualified_id): Use OVL_FIRST.
+ (pp_cxx_qualified_id, cxx_pretty_printer::id_expression,
+ cxx_pretty_printer::expression): Likewise.
+ * decl2.c (check_classfn): Use ovl_iterator.
+ * pt.c (retrieve_specialization): Use ovl_iterator.
+ * tree.c (cp_tree_equal): Use lkp_iterator.
+ (type_has_nontrivial_copy_init): Use ovl_iterator.
+
* typeck2.c (cxx_incomplete_type_diagnostic): Revert change and
check is_overloaded_fn.
/* We should never try to call the abstract or base constructor
from here. */
- gcc_assert (!DECL_HAS_IN_CHARGE_PARM_P (OVL_CURRENT (ctors))
- && !DECL_HAS_VTT_PARM_P (OVL_CURRENT (ctors)));
+ gcc_assert (!DECL_HAS_IN_CHARGE_PARM_P (OVL_FIRST (ctors))
+ && !DECL_HAS_VTT_PARM_P (OVL_FIRST (ctors)));
args = make_tree_vector_single (expr);
if (BRACE_ENCLOSED_INITIALIZER_P (expr))
targs = TREE_OPERAND (fn, 1);
fn = TREE_OPERAND (fn, 0);
}
- tree name = DECL_NAME (OVL_CURRENT (fn));
+ tree name = OVL_NAME (fn);
location_t loc = location_of (name);
if (targs)
name = lookup_template_function (name, targs);
for (; convs; convs = TREE_CHAIN (convs))
{
- tree fns = TREE_VALUE (convs);
tree totype = TREE_TYPE (convs);
if (TYPE_PTRFN_P (totype)
|| TYPE_REFFN_P (totype)
|| (TREE_CODE (totype) == REFERENCE_TYPE
&& TYPE_PTRFN_P (TREE_TYPE (totype))))
- for (; fns; fns = OVL_NEXT (fns))
+ for (ovl_iterator iter (TREE_VALUE (convs)); iter; ++iter)
{
- tree fn = OVL_CURRENT (fns);
+ tree fn = *iter;
if (DECL_NONCONVERTING_P (fn))
continue;
bool check_list_ctor;
bool check_converting;
unification_kind_t strict;
- tree fn;
if (!fns)
return;
/* Precalculate special handling of constructors and conversion ops. */
- fn = OVL_CURRENT (fns);
+ tree fn = OVL_FIRST (fns);
if (DECL_CONV_FN_P (fn))
{
check_list_ctor = false;
/* Delay creating the implicit this parameter until it is needed. */
non_static_args = NULL;
- for (; fns; fns = OVL_NEXT (fns))
+ for (lkp_iterator iter (fns); iter; ++iter)
{
tree fn_first_arg;
const vec<tree, va_gc> *fn_args;
- fn = OVL_CURRENT (fns);
+ fn = *iter;
if (check_converting && DECL_NONCONVERTING_P (fn))
continue;
if (fn == error_mark_node)
return NULL_TREE;
- if (BASELINK_P (fn))
- fn = BASELINK_FUNCTIONS (fn);
+ fn = MAYBE_BASELINK_FUNCTIONS (fn);
/* "If the lookup finds the two-parameter form of a usual deallocation
function (3.7.4.2) and that function, considered as a placement
the usual deallocation function, so we shouldn't complain
about using the operator delete (void *, size_t). */
if (DECL_CLASS_SCOPE_P (fn))
- for (t = BASELINK_P (fns) ? BASELINK_FUNCTIONS (fns) : fns;
- t; t = OVL_NEXT (t))
+ for (lkp_iterator iter (MAYBE_BASELINK_FUNCTIONS (fns));
+ iter; ++iter)
{
- tree elt = OVL_CURRENT (t);
+ tree elt = *iter;
if (usual_deallocation_fn_p (elt)
&& FUNCTION_ARG_CHAIN (elt) == void_list_node)
goto ok;
allocation function. If the lookup finds a single matching
deallocation function, that function will be called; otherwise, no
deallocation function will be called." */
- for (t = BASELINK_P (fns) ? BASELINK_FUNCTIONS (fns) : fns;
- t; t = OVL_NEXT (t))
+ for (lkp_iterator iter (MAYBE_BASELINK_FUNCTIONS (fns)); iter; ++iter)
{
- tree elt = OVL_CURRENT (t);
+ tree elt = *iter;
if (usual_deallocation_fn_p (elt))
{
if (!fn)
if (!CLASSTYPE_METHOD_VEC (t))
return;
- for (tree fns = CLASSTYPE_DESTRUCTORS (t); fns; fns = OVL_NEXT (fns))
- deduce_noexcept_on_destructor (OVL_CURRENT (fns));
+ for (ovl_iterator iter (CLASSTYPE_DESTRUCTORS (t)); iter; ++iter)
+ deduce_noexcept_on_destructor (*iter);
}
/* Subroutine of set_one_vmethod_tm_attributes. Search base classes
bool
type_has_user_nondefault_constructor (tree t)
{
- tree fns;
-
if (!TYPE_HAS_USER_CONSTRUCTOR (t))
return false;
- for (fns = CLASSTYPE_CONSTRUCTORS (t); fns; fns = OVL_NEXT (fns))
+ for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (t)); iter; ++iter)
{
- tree fn = OVL_CURRENT (fns);
+ tree fn = *iter;
if (!DECL_ARTIFICIAL (fn)
&& (TREE_CODE (fn) == TEMPLATE_DECL
|| (skip_artificial_parms_for (fn, DECL_ARGUMENTS (fn))
if (!TYPE_HAS_USER_CONSTRUCTOR (t))
return NULL_TREE;
- for (tree fns = CLASSTYPE_CONSTRUCTORS (t); fns; fns = OVL_NEXT (fns))
+ for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (t)); iter; ++iter)
{
- tree fn = OVL_CURRENT (fns);
+ tree fn = *iter;
if (DECL_DEFAULTED_IN_CLASS_P (fn)
&& default_ctor_p (fn))
bool
type_has_user_provided_constructor (tree t)
{
- tree fns;
-
if (!CLASS_TYPE_P (t))
return false;
if (!CLASSTYPE_METHOD_VEC (t))
return false;
- for (fns = CLASSTYPE_CONSTRUCTORS (t); fns; fns = OVL_NEXT (fns))
- if (user_provided_p (OVL_CURRENT (fns)))
+ for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (t)); iter; ++iter)
+ if (user_provided_p (*iter))
return true;
return false;
bool
type_has_user_provided_or_explicit_constructor (tree t)
{
- tree fns;
-
if (!CLASS_TYPE_P (t))
return false;
if (!CLASSTYPE_METHOD_VEC (t))
return false;
- for (fns = CLASSTYPE_CONSTRUCTORS (t); fns; fns = OVL_NEXT (fns))
+ for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (t)); iter; ++iter)
{
- tree fn = OVL_CURRENT (fns);
+ tree fn = *iter;
if (user_provided_p (fn) || DECL_NONCONVERTING_P (fn))
return true;
}
bool
type_has_non_user_provided_default_constructor (tree t)
{
- tree fns;
-
if (!TYPE_HAS_DEFAULT_CONSTRUCTOR (t))
return false;
if (CLASSTYPE_LAZY_DEFAULT_CTOR (t))
return true;
- for (fns = CLASSTYPE_CONSTRUCTORS (t); fns; fns = OVL_NEXT (fns))
+ for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (t)); iter; ++iter)
{
- tree fn = OVL_CURRENT (fns);
+ tree fn = *iter;
if (TREE_CODE (fn) == FUNCTION_DECL
&& default_ctor_p (fn)
&& !user_provided_p (fn))
vbase_has_user_provided_move_assign (tree type)
{
/* Does the type itself have a user-provided move assignment operator? */
- for (tree fns
- = lookup_fnfields_slot_nolazy (type, cp_assignment_operator_id (NOP_EXPR));
- fns; fns = OVL_NEXT (fns))
+ for (ovl_iterator iter (lookup_fnfields_slot_nolazy
+ (type, cp_assignment_operator_id (NOP_EXPR)));
+ iter; ++iter)
{
- tree fn = OVL_CURRENT (fns);
+ tree fn = *iter;
if (move_fn_p (fn) && user_provided_p (fn))
return true;
}
bool
type_has_move_constructor (tree t)
{
- tree fns;
-
if (CLASSTYPE_LAZY_MOVE_CTOR (t))
{
gcc_assert (COMPLETE_TYPE_P (t));
if (!CLASSTYPE_METHOD_VEC (t))
return false;
- for (fns = CLASSTYPE_CONSTRUCTORS (t); fns; fns = OVL_NEXT (fns))
- if (move_fn_p (OVL_CURRENT (fns)))
+ for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (t)); iter; ++iter)
+ if (move_fn_p (*iter))
return true;
return false;
bool
type_has_move_assign (tree t)
{
- tree fns;
-
if (CLASSTYPE_LAZY_MOVE_ASSIGN (t))
{
gcc_assert (COMPLETE_TYPE_P (t));
lazily_declare_fn (sfk_move_assignment, t);
}
- for (fns = lookup_fnfields_slot_nolazy (t, cp_assignment_operator_id (NOP_EXPR));
- fns; fns = OVL_NEXT (fns))
- if (move_fn_p (OVL_CURRENT (fns)))
+ for (ovl_iterator iter (lookup_fnfields_slot_nolazy
+ (t, cp_assignment_operator_id (NOP_EXPR)));
+ iter; ++iter)
+ if (move_fn_p (*iter))
return true;
return false;
bool
type_has_user_declared_move_constructor (tree t)
{
- tree fns;
-
if (CLASSTYPE_LAZY_MOVE_CTOR (t))
return false;
if (!CLASSTYPE_METHOD_VEC (t))
return false;
- for (fns = CLASSTYPE_CONSTRUCTORS (t); fns; fns = OVL_NEXT (fns))
+ for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (t)); iter; ++iter)
{
- tree fn = OVL_CURRENT (fns);
+ tree fn = *iter;
if (move_fn_p (fn) && !DECL_ARTIFICIAL (fn))
return true;
}
bool
type_has_user_declared_move_assign (tree t)
{
- tree fns;
-
if (CLASSTYPE_LAZY_MOVE_ASSIGN (t))
return false;
- for (fns = lookup_fnfields_slot_nolazy (t, cp_assignment_operator_id (NOP_EXPR));
- fns; fns = OVL_NEXT (fns))
+ for (ovl_iterator iter (lookup_fnfields_slot_nolazy
+ (t, cp_assignment_operator_id (NOP_EXPR)));
+ iter; ++iter)
{
- tree fn = OVL_CURRENT (fns);
+ tree fn = *iter;
if (move_fn_p (fn) && !DECL_ARTIFICIAL (fn))
return true;
}
return false;
/* A user-declared constructor might be private, and a constructor might
be trivial but deleted. */
- for (tree fns = lookup_fnfields_slot (inner, complete_ctor_identifier);
- fns; fns = OVL_NEXT (fns))
+ for (ovl_iterator iter
+ (lookup_fnfields_slot (inner, complete_ctor_identifier));
+ iter; ++iter)
{
- tree fn = OVL_CURRENT (fns);
+ tree fn = *iter;
if (!DECL_ARTIFICIAL (fn)
|| DECL_DELETED_FN (fn))
return true;
return false;
/* A user-declared destructor might be private, and a destructor might
be trivial but deleted. */
- for (tree fns = lookup_fnfields_slot (inner, complete_dtor_identifier);
- fns; fns = OVL_NEXT (fns))
+ for (ovl_iterator iter
+ (lookup_fnfields_slot (inner, complete_dtor_identifier));
+ iter; ++iter)
{
- tree fn = OVL_CURRENT (fns);
+ tree fn = *iter;
if (!DECL_ARTIFICIAL (fn)
|| DECL_DELETED_FN (fn))
return true;
if (!fns || fns == error_mark_node)
return false;
/* Loop through all of the functions. */
- for (fns = BASELINK_FUNCTIONS (fns); fns; fns = OVL_NEXT (fns))
+ for (lkp_iterator iter (BASELINK_FUNCTIONS (fns)); iter; ++iter)
{
- tree fn;
- tree second_parm;
+ tree fn = *iter;
- /* Select the current function. */
- fn = OVL_CURRENT (fns);
/* See if this function is a one-argument delete function. If
it is, then it will be the usual deallocation function. */
- second_parm = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (fn)));
+ tree second_parm = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (fn)));
if (second_parm == void_list_node)
return false;
/* Do not consider this function if its second argument is an
"default constructor, and has no constexpr constructor that "
"is not a copy or move constructor", t);
if (type_has_non_user_provided_default_constructor (t))
- {
- /* Note that we can't simply call locate_ctor because when the
- constructor is deleted it just returns NULL_TREE. */
- tree fns;
- for (fns = CLASSTYPE_CONSTRUCTORS (t); fns; fns = OVL_NEXT (fns))
- {
- tree fn = OVL_CURRENT (fns);
- tree parms = TYPE_ARG_TYPES (TREE_TYPE (fn));
+ /* Note that we can't simply call locate_ctor because when the
+ constructor is deleted it just returns NULL_TREE. */
+ for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (t)); iter; ++iter)
+ {
+ tree fn = *iter;
+ tree parms = TYPE_ARG_TYPES (TREE_TYPE (fn));
- parms = skip_artificial_parms_for (fn, parms);
+ parms = skip_artificial_parms_for (fn, parms);
- if (sufficient_parms_p (parms))
- {
- if (DECL_DELETED_FN (fn))
- maybe_explain_implicit_delete (fn);
- else
- explain_invalid_constexpr_fn (fn);
- break;
- }
- }
+ if (sufficient_parms_p (parms))
+ {
+ if (DECL_DELETED_FN (fn))
+ maybe_explain_implicit_delete (fn);
+ else
+ explain_invalid_constexpr_fn (fn);
+ break;
+ }
}
}
else
{
tree fn = strip_using_decl (x);
if (is_overloaded_fn (fn))
- for (; fn; fn = OVL_NEXT (fn))
- add_method (t, OVL_CURRENT (fn), x);
+ for (lkp_iterator iter (fn); iter; ++iter)
+ add_method (t, *iter, true);
}
/* Remember current #pragma pack value. */
if (complain & tf_error)
error ("cannot resolve overloaded function %qD based on"
" conversion to type %qT",
- DECL_NAME (OVL_FUNCTION (overload)), target_type);
+ OVL_NAME (overload), target_type);
return error_mark_node;
}
if we're just going to throw them out anyhow. But, of course, we
can only do this when we don't *need* a template function. */
if (!template_only)
- for (tree fns = overload; fns; fns = OVL_NEXT (fns))
+ for (lkp_iterator iter (overload); iter; ++iter)
{
- tree fn = OVL_CURRENT (fns);
+ tree fn = *iter;
if (TREE_CODE (fn) == TEMPLATE_DECL)
/* We're not looking for templates just yet. */
{
tree target_arg_types;
tree target_ret_type;
- tree fns;
tree *args;
unsigned int nargs, ia;
tree arg;
args[ia] = TREE_VALUE (arg);
nargs = ia;
- for (fns = overload; fns; fns = OVL_NEXT (fns))
+ for (lkp_iterator iter (overload); iter; ++iter)
{
- tree fn = OVL_CURRENT (fns);
+ tree fn = *iter;
tree instantiation;
tree targs;
if (complain & tf_error)
{
error ("no matches converting function %qD to type %q#T",
- DECL_NAME (OVL_CURRENT (overload)),
- target_type);
+ OVL_NAME (overload), target_type);
print_candidates (overload);
}
if (complain & tf_error)
{
error ("converting overloaded function %qD to type %q#T is ambiguous",
- DECL_NAME (OVL_FUNCTION (overload)),
- target_type);
+ OVL_NAME (overload), target_type);
/* Since print_candidates expects the functions in the
TREE_VALUE slot, we flip them here. */
permerror (input_location, "declaration of %q#D", decl);
permerror (location_of ((tree) n->value),
"changes meaning of %qD from %q#D",
- DECL_NAME (OVL_CURRENT (decl)), (tree) n->value);
+ OVL_NAME (decl), (tree) n->value);
}
}
break;
case OVERLOAD:
- t = OVL_CURRENT (t);
+ t = OVL_FIRST (t);
/* FALLTHRU */
case VAR_DECL:
case PARM_DECL:
FIXME: This is probably the wrong pretty-printing for conversion
functions and some function templates. */
case OVERLOAD:
- t = OVL_CURRENT (t);
+ t = OVL_FIRST (t);
/* FALLTHRU */
case FUNCTION_DECL:
if (DECL_FUNCTION_MEMBER_P (t))
cxx_pretty_printer::id_expression (tree t)
{
if (TREE_CODE (t) == OVERLOAD)
- t = OVL_CURRENT (t);
+ t = OVL_FIRST (t);
if (DECL_P (t) && DECL_CONTEXT (t))
pp_cxx_qualified_id (this, t);
else
break;
case OVERLOAD:
- t = OVL_CURRENT (t);
+ t = OVL_FIRST (t);
/* FALLTHRU */
case VAR_DECL:
case PARM_DECL:
if (ix >= 0)
{
vec<tree, va_gc> *methods = CLASSTYPE_METHOD_VEC (ctype);
- tree fndecls, fndecl = 0;
- bool is_conv_op;
- const char *format = NULL;
- for (fndecls = (*methods)[ix];
- fndecls; fndecls = OVL_NEXT (fndecls))
+ for (ovl_iterator iter ((*methods)[ix]); iter; ++iter)
{
- tree p1, p2;
-
- fndecl = OVL_CURRENT (fndecls);
- p1 = TYPE_ARG_TYPES (TREE_TYPE (function));
- p2 = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
+ tree fndecl = *iter;
+ tree p1 = TYPE_ARG_TYPES (TREE_TYPE (function));
+ tree p2 = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
/* We cannot simply call decls_match because this doesn't
work for static member functions that are pretending to
&& (!DECL_TEMPLATE_SPECIALIZATION (function)
|| (DECL_TI_TEMPLATE (function)
== DECL_TI_TEMPLATE (fndecl))))
- break;
- }
- if (fndecls)
- {
- if (pushed_scope)
- pop_scope (pushed_scope);
- return OVL_CURRENT (fndecls);
+ {
+ if (pushed_scope)
+ pop_scope (pushed_scope);
+ return fndecl;
+ }
}
-
+
error_at (DECL_SOURCE_LOCATION (function),
"prototype for %q#D does not match any in class %qT",
function, ctype);
- is_conv_op = DECL_CONV_FN_P (fndecl);
+
+ const char *format = NULL;
+ tree first = OVL_FIRST ((*methods)[ix]);
+ bool is_conv_op = DECL_CONV_FN_P (first);
+ tree prev = NULL_TREE;
if (is_conv_op)
ix = CLASSTYPE_FIRST_CONVERSION_SLOT;
- fndecls = (*methods)[ix];
- while (fndecls)
+ do
{
- fndecl = OVL_CURRENT (fndecls);
- fndecls = OVL_NEXT (fndecls);
-
- if (!fndecls && is_conv_op)
+ ovl_iterator iter ((*methods)[ix++]);
+ if (is_conv_op && !DECL_CONV_FN_P (*iter))
+ break;
+ for (; iter; ++iter)
{
- if (methods->length () > (size_t) ++ix)
+ if (prev)
{
- fndecls = (*methods)[ix];
- if (!DECL_CONV_FN_P (OVL_CURRENT (fndecls)))
- {
- fndecls = NULL_TREE;
- is_conv_op = false;
- }
+ if (!format)
+ format = N_("candidates are: %+#D");
+ error (format, prev);
+ format = " %+#D";
}
- else
- is_conv_op = false;
+ prev = *iter;
}
- if (format)
- format = " %+#D";
- else if (fndecls)
- format = N_("candidates are: %+#D");
- else
+ }
+ while (is_conv_op && size_t (ix) < methods->length ());
+ if (prev)
+ {
+ if (!format)
format = N_("candidate is: %+#D");
- error (format, fndecl);
+ error (format, prev);
}
}
else if (!COMPLETE_TYPE_P (ctype))
if (optimize_specialization_lookup_p (tmpl))
{
- tree class_template;
- tree class_specialization;
- vec<tree, va_gc> *methods;
- tree fns;
- int idx;
-
/* The template arguments actually apply to the containing
class. Find the class specialization with those
arguments. */
- class_template = CLASSTYPE_TI_TEMPLATE (DECL_CONTEXT (tmpl));
- class_specialization
+ tree class_template = CLASSTYPE_TI_TEMPLATE (DECL_CONTEXT (tmpl));
+ tree class_specialization
= retrieve_specialization (class_template, args, 0);
if (!class_specialization)
return NULL_TREE;
/* Now, find the appropriate entry in the CLASSTYPE_METHOD_VEC
for the specialization. */
- idx = class_method_index_for_fn (class_specialization, tmpl);
+ int idx = class_method_index_for_fn (class_specialization, tmpl);
if (idx == -1)
return NULL_TREE;
/* Iterate through the methods with the indicated name, looking
for the one that has an instance of TMPL. */
- methods = CLASSTYPE_METHOD_VEC (class_specialization);
- for (fns = (*methods)[idx]; fns; fns = OVL_NEXT (fns))
+ vec<tree, va_gc> *methods = CLASSTYPE_METHOD_VEC (class_specialization);
+ for (ovl_iterator iter ((*methods)[idx]); iter; ++iter)
{
- tree fn = OVL_CURRENT (fns);
+ tree fn = *iter;
if (DECL_TEMPLATE_INFO (fn) && DECL_TI_TEMPLATE (fn) == tmpl
/* using-declarations can add base methods to the method vec,
and we don't want those here. */
return same_type_p (PTRMEM_CST_CLASS (t1), PTRMEM_CST_CLASS (t2));
case OVERLOAD:
- if (OVL_FUNCTION (t1) != OVL_FUNCTION (t2))
- return false;
- return cp_tree_equal (OVL_CHAIN (t1), OVL_CHAIN (t2));
+ {
+ /* Two overloads. Must be exactly the same set of decls. */
+ lkp_iterator first (t1);
+ lkp_iterator second (t2);
+
+ for (; first && second; ++first, ++second)
+ if (*first != *second)
+ return false;
+ return !(first || second);
+ }
case TRAIT_EXPR:
if (TRAIT_EXPR_KIND (t1) != TRAIT_EXPR_KIND (t2))
}
if (!saw_non_deleted && CLASSTYPE_METHOD_VEC (t))
- for (tree fns = CLASSTYPE_CONSTRUCTORS (t); fns; fns = OVL_NEXT (fns))
+ for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (t)); iter; ++iter)
{
- tree fn = OVL_CURRENT (fns);
+ tree fn = *iter;
if (copy_fn_p (fn))
{
saw_copy = true;