diff options
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r-- | gcc/cp/call.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index de3434b3dea..d899d45ec6d 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -2082,7 +2082,7 @@ add_function_candidate (struct z_candidate **candidates, if (DECL_CONSTRUCTOR_P (fn)) i = 1; else if (DECL_ASSIGNMENT_OPERATOR_P (fn) - && DECL_OVERLOADED_OPERATOR_P (fn) == NOP_EXPR) + && DECL_OVERLOADED_OPERATOR_IS (fn, NOP_EXPR)) i = 2; else i = 0; @@ -4474,7 +4474,7 @@ build_op_call_1 (tree obj, vec<tree, va_gc> **args, tsubst_flags_t complain) if (TYPE_BINFO (type)) { - fns = lookup_fnfields (TYPE_BINFO (type), cp_operator_id (CALL_EXPR), 1); + fns = lookup_fnfields (TYPE_BINFO (type), call_op_identifier, 1); if (fns == error_mark_node) return error_mark_node; } @@ -4557,11 +4557,9 @@ build_op_call_1 (tree obj, vec<tree, va_gc> **args, tsubst_flags_t complain) } result = error_mark_node; } - /* Since cand->fn will be a type, not a function, for a conversion - function, we must be careful not to unconditionally look at - DECL_NAME here. */ else if (TREE_CODE (cand->fn) == FUNCTION_DECL - && DECL_OVERLOADED_OPERATOR_P (cand->fn) == CALL_EXPR) + && DECL_OVERLOADED_OPERATOR_P (cand->fn) + && DECL_OVERLOADED_OPERATOR_IS (cand->fn, CALL_EXPR)) result = build_over_call (cand, LOOKUP_NORMAL, complain); else { @@ -8116,7 +8114,8 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) return val; } } - else if (DECL_OVERLOADED_OPERATOR_P (fn) == NOP_EXPR + else if (DECL_ASSIGNMENT_OPERATOR_P (fn) + && DECL_OVERLOADED_OPERATOR_IS (fn, NOP_EXPR) && trivial_fn_p (fn) && !DECL_DELETED_FN (fn)) { @@ -8284,7 +8283,7 @@ first_non_public_field (tree type) static bool has_trivial_copy_assign_p (tree type, bool access, bool *hasassign) { - tree fns = get_class_binding (type, cp_assignment_operator_id (NOP_EXPR)); + tree fns = get_class_binding (type, assign_op_identifier); bool all_trivial = true; /* Iterate over overloads of the assignment operator, checking @@ -8784,8 +8783,7 @@ build_special_member_call (tree instance, tree name, vec<tree, va_gc> **args, vec<tree, va_gc> *allocated = NULL; tree ret; - gcc_assert (IDENTIFIER_CDTOR_P (name) - || name == cp_assignment_operator_id (NOP_EXPR)); + gcc_assert (IDENTIFIER_CDTOR_P (name) || name == assign_op_identifier); if (TYPE_P (binfo)) { /* Resolve the name. */ @@ -8811,7 +8809,7 @@ build_special_member_call (tree instance, tree name, vec<tree, va_gc> **args, if (!same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (instance), BINFO_TYPE (binfo))) { - if (name != cp_assignment_operator_id (NOP_EXPR)) + if (IDENTIFIER_CDTOR_P (name)) /* For constructors and destructors, either the base is non-virtual, or it is virtual but we are doing the conversion from a constructor or destructor for the @@ -8819,10 +8817,13 @@ build_special_member_call (tree instance, tree name, vec<tree, va_gc> **args, statically. */ instance = convert_to_base_statically (instance, binfo); else - /* However, for assignment operators, we must convert - dynamically if the base is virtual. */ - instance = build_base_path (PLUS_EXPR, instance, - binfo, /*nonnull=*/1, complain); + { + /* However, for assignment operators, we must convert + dynamically if the base is virtual. */ + gcc_checking_assert (name == assign_op_identifier); + instance = build_base_path (PLUS_EXPR, instance, + binfo, /*nonnull=*/1, complain); + } } } |