From 60f80e6541b845a20827b8584d8c276f54ed7506 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Fri, 21 Jul 2017 17:58:48 +0000 Subject: [PATCH] call.c (add_candidates): Move decls to initialization. * call.c (add_candidates): Move decls to initialization. Don't use !!. From-SVN: r250434 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/call.c | 29 +++++++++-------------------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 234d0425839..7adedbe34f8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2017-07-21 Nathan Sidwell + + * call.c (add_candidates): Move decls to initialization. Don't + use !!. + 2017-07-20 Nathan Sidwell Remove TYPE_METHODS. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index fac6b6c16ac..e74d48daa8b 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5423,8 +5423,8 @@ add_candidates (tree fns, tree first_arg, const vec *args, { tree ctype; const vec *non_static_args; - bool check_list_ctor; - bool check_converting; + bool check_list_ctor = false; + bool check_converting = false; unification_kind_t strict; if (!fns) @@ -5435,7 +5435,7 @@ add_candidates (tree fns, tree first_arg, const vec *args, if (DECL_CONV_FN_P (fn)) { check_list_ctor = false; - check_converting = !!(flags & LOOKUP_ONLYCONVERTING); + check_converting = (flags & LOOKUP_ONLYCONVERTING) != 0; if (flags & LOOKUP_NO_CONVERSION) /* We're doing return_type(x). */ strict = DEDUCE_CONV; @@ -5452,18 +5452,13 @@ add_candidates (tree fns, tree first_arg, const vec *args, { if (DECL_CONSTRUCTOR_P (fn)) { - check_list_ctor = !!(flags & LOOKUP_LIST_ONLY); + check_list_ctor = (flags & LOOKUP_LIST_ONLY) != 0; /* For list-initialization we consider explicit constructors and complain if one is chosen. */ check_converting = ((flags & (LOOKUP_ONLYCONVERTING|LOOKUP_LIST_INIT_CTOR)) == LOOKUP_ONLYCONVERTING); } - else - { - check_list_ctor = false; - check_converting = false; - } strict = DEDUCE_CALL; ctype = conversion_path ? BINFO_TYPE (conversion_path) : NULL_TREE; } @@ -5476,9 +5471,6 @@ add_candidates (tree fns, tree first_arg, const vec *args, for (lkp_iterator iter (fns); iter; ++iter) { - tree fn_first_arg; - const vec *fn_args; - fn = *iter; if (check_converting && DECL_NONCONVERTING_P (fn)) @@ -5486,10 +5478,13 @@ add_candidates (tree fns, tree first_arg, const vec *args, if (check_list_ctor && !is_list_ctor (fn)) continue; - /* Figure out which set of arguments to use. */ + tree fn_first_arg = NULL_TREE; + const vec *fn_args = args; + if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)) { - /* If this function is a non-static member and we didn't get an + /* Figure out where the object arg comes from. If this + function is a non-static member and we didn't get an implicit object argument, move it out of args. */ if (first_arg == NULL_TREE) { @@ -5506,12 +5501,6 @@ add_candidates (tree fns, tree first_arg, const vec *args, fn_first_arg = first_arg; fn_args = non_static_args; } - else - { - /* Otherwise, just use the list of arguments provided. */ - fn_first_arg = NULL_TREE; - fn_args = args; - } if (TREE_CODE (fn) == TEMPLATE_DECL) add_template_candidate (candidates, -- 2.30.2