Deleted Added
full compact
call.c (52284) call.c (60967)
1/* Functions related to invoking methods and overloaded functions.
2 Copyright (C) 1987, 92-97, 1998, 1999 Free Software Foundation, Inc.
3 Contributed by Michael Tiemann (tiemann@cygnus.com) and
4 modified by Brendan Kehoe (brendan@cygnus.com).
5
6This file is part of GNU CC.
7
8GNU CC is free software; you can redistribute it and/or modify

--- 1051 unchanged lines hidden (view full) ---

1060 int flags;
1061{
1062 tree parmlist = TYPE_ARG_TYPES (TREE_TYPE (fn));
1063 int i, len;
1064 tree convs;
1065 tree parmnode, argnode;
1066 int viable = 1;
1067
1/* Functions related to invoking methods and overloaded functions.
2 Copyright (C) 1987, 92-97, 1998, 1999 Free Software Foundation, Inc.
3 Contributed by Michael Tiemann (tiemann@cygnus.com) and
4 modified by Brendan Kehoe (brendan@cygnus.com).
5
6This file is part of GNU CC.
7
8GNU CC is free software; you can redistribute it and/or modify

--- 1051 unchanged lines hidden (view full) ---

1060 int flags;
1061{
1062 tree parmlist = TYPE_ARG_TYPES (TREE_TYPE (fn));
1063 int i, len;
1064 tree convs;
1065 tree parmnode, argnode;
1066 int viable = 1;
1067
1068 /* The `this' and `in_chrg' arguments to constructors are not considered
1069 in overload resolution. */
1068 /* The `this', `in_chrg', and `vlist' arguments to constructors are
1069 not considered in overload resolution. */
1070 if (DECL_CONSTRUCTOR_P (fn))
1071 {
1072 parmlist = TREE_CHAIN (parmlist);
1073 arglist = TREE_CHAIN (arglist);
1074 if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn)))
1075 {
1076 parmlist = TREE_CHAIN (parmlist);
1077 arglist = TREE_CHAIN (arglist);
1078 }
1070 if (DECL_CONSTRUCTOR_P (fn))
1071 {
1072 parmlist = TREE_CHAIN (parmlist);
1073 arglist = TREE_CHAIN (arglist);
1074 if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn)))
1075 {
1076 parmlist = TREE_CHAIN (parmlist);
1077 arglist = TREE_CHAIN (arglist);
1078 }
1079 if ((flags & LOOKUP_HAS_VLIST)
1080 && DECL_CONSTRUCTOR_FOR_PVBASE_P (fn))
1081 {
1082 parmlist = TREE_CHAIN (parmlist);
1083 arglist = TREE_CHAIN (arglist);
1084 }
1085 else if (!(flags & LOOKUP_HAS_VLIST)
1086 && !DECL_CONSTRUCTOR_FOR_PVBASE_P (fn))
1087 /* Ok */;
1088 else
1089 {
1090 /* The ctor expects a vlist and the arguments don't have
1091 one, or vice versa, so fn is not even a candidate, since
1092 the corresponding ctor would be the candidate. */
1093 return candidates;
1094 }
1079 }
1080
1081 len = list_length (arglist);
1082 convs = make_scratch_vec (len);
1083
1084 /* 13.3.2 - Viable functions [over.match.viable]
1085 First, to be a viable function, a candidate function shall have enough
1086 parameters to agree in number with the arguments in the list.

--- 979 unchanged lines hidden (view full) ---

2066 candidates = 0;
2067 flags |= LOOKUP_NO_CONVERSION;
2068
2069 if (ctors)
2070 {
2071 tree t = build_int_2 (0, 0);
2072 TREE_TYPE (t) = build_pointer_type (totype);
2073 args = build_scratch_list (NULL_TREE, expr);
1095 }
1096
1097 len = list_length (arglist);
1098 convs = make_scratch_vec (len);
1099
1100 /* 13.3.2 - Viable functions [over.match.viable]
1101 First, to be a viable function, a candidate function shall have enough
1102 parameters to agree in number with the arguments in the list.

--- 979 unchanged lines hidden (view full) ---

2082 candidates = 0;
2083 flags |= LOOKUP_NO_CONVERSION;
2084
2085 if (ctors)
2086 {
2087 tree t = build_int_2 (0, 0);
2088 TREE_TYPE (t) = build_pointer_type (totype);
2089 args = build_scratch_list (NULL_TREE, expr);
2090 if (TYPE_USES_PVBASES (totype) && !flag_vtable_thunks_compat)
2091 {
2092 args = scratch_tree_cons (NULL_TREE, vlist_zero_node, args);
2093 flags |= LOOKUP_HAS_VLIST;
2094 }
2074 if (TYPE_USES_VIRTUAL_BASECLASSES (totype))
2075 args = scratch_tree_cons (NULL_TREE, integer_one_node, args);
2076 args = scratch_tree_cons (NULL_TREE, t, args);
2077
2078 ctors = TREE_VALUE (ctors);
2079 }
2080 for (; ctors; ctors = OVL_NEXT (ctors))
2081 {

--- 951 unchanged lines hidden (view full) ---

3033 switch (TREE_CODE (convs))
3034 {
3035 case USER_CONV:
3036 {
3037 struct z_candidate *cand
3038 = WRAPPER_PTR (TREE_OPERAND (convs, 1));
3039 tree fn = cand->fn;
3040 tree args;
2095 if (TYPE_USES_VIRTUAL_BASECLASSES (totype))
2096 args = scratch_tree_cons (NULL_TREE, integer_one_node, args);
2097 args = scratch_tree_cons (NULL_TREE, t, args);
2098
2099 ctors = TREE_VALUE (ctors);
2100 }
2101 for (; ctors; ctors = OVL_NEXT (ctors))
2102 {

--- 951 unchanged lines hidden (view full) ---

3054 switch (TREE_CODE (convs))
3055 {
3056 case USER_CONV:
3057 {
3058 struct z_candidate *cand
3059 = WRAPPER_PTR (TREE_OPERAND (convs, 1));
3060 tree fn = cand->fn;
3061 tree args;
3062 int flags = LOOKUP_NORMAL;
3041
3042 if (DECL_CONSTRUCTOR_P (fn))
3043 {
3044 tree t = build_int_2 (0, 0);
3045 TREE_TYPE (t) = build_pointer_type (DECL_CONTEXT (fn));
3046
3047 args = build_scratch_list (NULL_TREE, expr);
3063
3064 if (DECL_CONSTRUCTOR_P (fn))
3065 {
3066 tree t = build_int_2 (0, 0);
3067 TREE_TYPE (t) = build_pointer_type (DECL_CONTEXT (fn));
3068
3069 args = build_scratch_list (NULL_TREE, expr);
3070 if (TYPE_USES_PVBASES (DECL_CONTEXT (fn))
3071 && !flag_vtable_thunks_compat)
3072 {
3073 args = scratch_tree_cons (NULL_TREE, vlist_zero_node, args);
3074 flags != LOOKUP_HAS_VLIST;
3075 }
3048 if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn)))
3049 args = scratch_tree_cons (NULL_TREE, integer_one_node, args);
3050 args = scratch_tree_cons (NULL_TREE, t, args);
3051 }
3052 else
3053 args = build_this (expr);
3076 if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn)))
3077 args = scratch_tree_cons (NULL_TREE, integer_one_node, args);
3078 args = scratch_tree_cons (NULL_TREE, t, args);
3079 }
3080 else
3081 args = build_this (expr);
3054 expr = build_over_call (cand, args, LOOKUP_NORMAL);
3082 expr = build_over_call (cand, args, flags);
3055
3056 /* If this is a constructor or a function returning an aggr type,
3057 we need to build up a TARGET_EXPR. */
3058 if (DECL_CONSTRUCTOR_P (fn))
3059 expr = build_cplus_new (TREE_TYPE (convs), expr);
3060
3061 return expr;
3062 }

--- 192 unchanged lines hidden (view full) ---

3255 parm = TREE_CHAIN (parm);
3256 if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn)))
3257 {
3258 converted_args = expr_tree_cons
3259 (NULL_TREE, TREE_VALUE (arg), converted_args);
3260 arg = TREE_CHAIN (arg);
3261 parm = TREE_CHAIN (parm);
3262 }
3083
3084 /* If this is a constructor or a function returning an aggr type,
3085 we need to build up a TARGET_EXPR. */
3086 if (DECL_CONSTRUCTOR_P (fn))
3087 expr = build_cplus_new (TREE_TYPE (convs), expr);
3088
3089 return expr;
3090 }

--- 192 unchanged lines hidden (view full) ---

3283 parm = TREE_CHAIN (parm);
3284 if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn)))
3285 {
3286 converted_args = expr_tree_cons
3287 (NULL_TREE, TREE_VALUE (arg), converted_args);
3288 arg = TREE_CHAIN (arg);
3289 parm = TREE_CHAIN (parm);
3290 }
3291 if (flags & LOOKUP_HAS_VLIST)
3292 {
3293 converted_args = expr_tree_cons
3294 (NULL_TREE, TREE_VALUE (arg), converted_args);
3295 arg = TREE_CHAIN (arg);
3296 parm = TREE_CHAIN (parm);
3297 }
3263 }
3264 /* Bypass access control for 'this' parameter. */
3265 else if (TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE)
3266 {
3267 tree parmtype = TREE_VALUE (parm);
3268 tree argtype = TREE_TYPE (TREE_VALUE (arg));
3269 tree t;
3270 if (ICS_BAD_FLAG (TREE_VEC_ELT (convs, i)))

--- 93 unchanged lines hidden (view full) ---

3364 else if (DECL_CONSTRUCTOR_P (fn)
3365 && TREE_VEC_LENGTH (convs) == 1
3366 && copy_args_p (fn))
3367 {
3368 tree targ;
3369 arg = TREE_CHAIN (converted_args);
3370 if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn)))
3371 arg = TREE_CHAIN (arg);
3298 }
3299 /* Bypass access control for 'this' parameter. */
3300 else if (TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE)
3301 {
3302 tree parmtype = TREE_VALUE (parm);
3303 tree argtype = TREE_TYPE (TREE_VALUE (arg));
3304 tree t;
3305 if (ICS_BAD_FLAG (TREE_VEC_ELT (convs, i)))

--- 93 unchanged lines hidden (view full) ---

3399 else if (DECL_CONSTRUCTOR_P (fn)
3400 && TREE_VEC_LENGTH (convs) == 1
3401 && copy_args_p (fn))
3402 {
3403 tree targ;
3404 arg = TREE_CHAIN (converted_args);
3405 if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn)))
3406 arg = TREE_CHAIN (arg);
3407 if (flags & LOOKUP_HAS_VLIST)
3408 arg = TREE_CHAIN (arg);
3372 arg = TREE_VALUE (arg);
3373
3374 /* Pull out the real argument, disregarding const-correctness. */
3375 targ = arg;
3376 while (TREE_CODE (targ) == NOP_EXPR
3377 || TREE_CODE (targ) == NON_LVALUE_EXPR
3378 || TREE_CODE (targ) == CONVERT_EXPR)
3379 targ = TREE_OPERAND (targ, 0);

--- 159 unchanged lines hidden (view full) ---

3539
3540 template_only = 1;
3541 }
3542
3543 /* If there is an extra argument for controlling virtual bases,
3544 remove it for error reporting. */
3545 if (flags & LOOKUP_HAS_IN_CHARGE)
3546 user_args = TREE_CHAIN (args);
3409 arg = TREE_VALUE (arg);
3410
3411 /* Pull out the real argument, disregarding const-correctness. */
3412 targ = arg;
3413 while (TREE_CODE (targ) == NOP_EXPR
3414 || TREE_CODE (targ) == NON_LVALUE_EXPR
3415 || TREE_CODE (targ) == CONVERT_EXPR)
3416 targ = TREE_OPERAND (targ, 0);

--- 159 unchanged lines hidden (view full) ---

3576
3577 template_only = 1;
3578 }
3579
3580 /* If there is an extra argument for controlling virtual bases,
3581 remove it for error reporting. */
3582 if (flags & LOOKUP_HAS_IN_CHARGE)
3583 user_args = TREE_CHAIN (args);
3584 if (flags & LOOKUP_HAS_VLIST)
3585 user_args = TREE_CHAIN (user_args);
3547
3548 args = resolve_args (args);
3549
3550 if (args == error_mark_node)
3551 return error_mark_node;
3552
3553 if (instance == NULL_TREE)
3554 basetype = BINFO_TYPE (basetype_path);

--- 56 unchanged lines hidden (view full) ---

3611 if (fns == error_mark_node)
3612 return error_mark_node;
3613 if (fns)
3614 {
3615 tree fn = TREE_VALUE (fns);
3616 if (name == ctor_identifier && TYPE_USES_VIRTUAL_BASECLASSES (basetype)
3617 && ! (flags & LOOKUP_HAS_IN_CHARGE))
3618 {
3586
3587 args = resolve_args (args);
3588
3589 if (args == error_mark_node)
3590 return error_mark_node;
3591
3592 if (instance == NULL_TREE)
3593 basetype = BINFO_TYPE (basetype_path);

--- 56 unchanged lines hidden (view full) ---

3650 if (fns == error_mark_node)
3651 return error_mark_node;
3652 if (fns)
3653 {
3654 tree fn = TREE_VALUE (fns);
3655 if (name == ctor_identifier && TYPE_USES_VIRTUAL_BASECLASSES (basetype)
3656 && ! (flags & LOOKUP_HAS_IN_CHARGE))
3657 {
3658 if (TYPE_USES_PVBASES(basetype)
3659 && (!flag_vtable_thunks_compat || (name == dtor_identifier)))
3660 {
3661 args = scratch_tree_cons (NULL_TREE, vlist_zero_node, args);
3662 flags |= LOOKUP_HAS_VLIST;
3663 }
3619 flags |= LOOKUP_HAS_IN_CHARGE;
3620 args = scratch_tree_cons (NULL_TREE, integer_one_node, args);
3621 }
3622 mem_args = scratch_tree_cons (NULL_TREE, instance_ptr, args);
3623 for (; fn; fn = OVL_NEXT (fn))
3624 {
3625 tree t = OVL_CURRENT (fn);
3626 tree this_arglist;

--- 887 unchanged lines hidden ---
3664 flags |= LOOKUP_HAS_IN_CHARGE;
3665 args = scratch_tree_cons (NULL_TREE, integer_one_node, args);
3666 }
3667 mem_args = scratch_tree_cons (NULL_TREE, instance_ptr, args);
3668 for (; fn; fn = OVL_NEXT (fn))
3669 {
3670 tree t = OVL_CURRENT (fn);
3671 tree this_arglist;

--- 887 unchanged lines hidden ---