Annotation of GNUtools/cc/cp-call.c, revision 1.1

1.1     ! root        1: /* Functions related to invoking methods and overloaded functions.
        !             2:    Copyright (C) 1987, 1992, 1993 Free Software Foundation, Inc.
        !             3:    Contributed by Michael Tiemann ([email protected]) and
        !             4:    hacked by Brendan Kehoe ([email protected]).
        !             5: 
        !             6: This file is part of GNU CC.
        !             7: 
        !             8: GNU CC is free software; you can redistribute it and/or modify
        !             9: it under the terms of the GNU General Public License as published by
        !            10: the Free Software Foundation; either version 2, or (at your option)
        !            11: any later version.
        !            12: 
        !            13: GNU CC is distributed in the hope that it will be useful,
        !            14: but WITHOUT ANY WARRANTY; without even the implied warranty of
        !            15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        !            16: GNU General Public License for more details.
        !            17: 
        !            18: You should have received a copy of the GNU General Public License
        !            19: along with GNU CC; see the file COPYING.  If not, write to
        !            20: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
        !            21: 
        !            22: 
        !            23: /* High-level class interface. */
        !            24: 
        !            25: #include "config.h"
        !            26: #include "tree.h"
        !            27: #include <stdio.h>
        !            28: #include "cp-tree.h"
        !            29: #include "cp-class.h"
        !            30: #include "flags.h"
        !            31: 
        !            32: #include "obstack.h"
        !            33: #define obstack_chunk_alloc xmalloc
        !            34: #define obstack_chunk_free free
        !            35: 
        !            36: extern void sorry ();
        !            37: 
        !            38: extern int inhibit_warnings;
        !            39: extern int flag_assume_nonnull_objects;
        !            40: extern tree ctor_label, dtor_label;
        !            41: 
        !            42: /* From cp-typeck.c:  */
        !            43: extern tree unary_complex_lvalue ();
        !            44: 
        !            45: /* Compute the ease with which a conversion can be performed
        !            46:    between an expected and the given type.  */
        !            47: static int convert_harshness_old ();
        !            48: static struct harshness_code convert_harshness_ansi ();
        !            49: 
        !            50: /* OLD METHOD */
        !            51: /* Note the old method also uses USER_HARSHNESS, BASE_DERIVED_HARSHNESS,
        !            52:    CONST_HARSHNESS.  */
        !            53: #define EVIL 1
        !            54: #define TRIVIAL 0
        !            55: #define EVIL_HARSHNESS(ARG) ((ARG) & 1)
        !            56: #define ELLIPSIS_HARSHNESS(ARG) ((ARG) & 2)
        !            57: #define CONTRAVARIANT_HARSHNESS(ARG) ((ARG) & 8)
        !            58: #define INT_TO_BD_HARSHNESS(ARG) (((ARG) << 5) | 16)
        !            59: #define INT_FROM_BD_HARSHNESS(ARG) ((ARG) >> 5)
        !            60: #define INT_TO_EASY_HARSHNESS(ARG) ((ARG) << 5)
        !            61: #define INT_FROM_EASY_HARSHNESS(ARG) ((ARG) >> 5)
        !            62: #define ONLY_EASY_HARSHNESS(ARG) (((ARG) & 31) == 0)
        !            63: 
        !            64: 
        !            65: /* NEW METHOD */
        !            66: #define EVIL_RETURN(ARG)       ((ARG).code = EVIL_CODE, (ARG))
        !            67: #define QUAL_RETURN(ARG)       ((ARG).code = QUAL_CODE, (ARG))
        !            68: #define TRIVIAL_RETURN(ARG)    ((ARG).code = TRIVIAL_CODE, (ARG))
        !            69: #define ZERO_RETURN(ARG)       ((ARG).code = 0, (ARG))
        !            70: 
        !            71: #define USER_HARSHNESS(ARG) ((ARG) & 4)
        !            72: #define BASE_DERIVED_HARSHNESS(ARG) ((ARG) & 16)
        !            73: #define CONST_HARSHNESS(ARG) ((ARG) & 2048)
        !            74: 
        !            75: /* Ordering function for overload resolution.  Compare two candidates
        !            76:    by gross quality.  */
        !            77: int
        !            78: rank_for_overload_ansi (x, y)
        !            79:      struct candidate *x, *y;
        !            80: {
        !            81:   if (y->h.code & (EVIL_CODE|ELLIPSIS_CODE|USER_CODE))
        !            82:     return y->h.code - x->h.code;
        !            83:   if (x->h.code & (EVIL_CODE|ELLIPSIS_CODE|USER_CODE))
        !            84:     return -1;
        !            85: 
        !            86:   /* This is set by compute_conversion_costs, for calling a non-const
        !            87:      member function from a const member function.  */
        !            88:   if ((y->v.ansi_harshness[0].code & CONST_CODE) ^ (x->v.ansi_harshness[0].code & CONST_CODE))
        !            89:     return y->v.ansi_harshness[0].code - x->v.ansi_harshness[0].code;
        !            90: 
        !            91:   if (y->h.code & STD_CODE)
        !            92:     {
        !            93:       if (x->h.code & STD_CODE)
        !            94:        return y->h.distance - x->h.distance;
        !            95:       return 1;
        !            96:     }
        !            97:   if (x->h.code & STD_CODE)
        !            98:     return -1;
        !            99: 
        !           100:   return y->h.code - x->h.code;
        !           101: }
        !           102: 
        !           103: int
        !           104: rank_for_overload_old (x, y)
        !           105:      struct candidate *x, *y;
        !           106: {
        !           107:   if (y->evil - x->evil)
        !           108:     return y->evil - x->evil;
        !           109:   if (CONST_HARSHNESS (y->v.old_harshness[0]) ^ CONST_HARSHNESS (x->v.old_harshness[0]))
        !           110:     return y->v.old_harshness[0] - x->v.old_harshness[0];
        !           111:   if (y->ellipsis - x->ellipsis)
        !           112:     return y->ellipsis - x->ellipsis;
        !           113:   if (y->user - x->user)
        !           114:     return y->user - x->user;
        !           115:   if (y->b_or_d - x->b_or_d)
        !           116:     return y->b_or_d - x->b_or_d;
        !           117:   return y->easy - x->easy;
        !           118: }
        !           119: 
        !           120: int
        !           121: rank_for_overload (x, y)
        !           122:      struct candidate *x, *y;
        !           123: {
        !           124:   if (flag_ansi_overloading)
        !           125:     return rank_for_overload_ansi (x, y);
        !           126:   else
        !           127:     return rank_for_overload_old (x, y);
        !           128: }
        !           129: 
        !           130: /* Compare two candidates, argument by argument.  */
        !           131: int
        !           132: rank_for_ideal (x, y)
        !           133:      struct candidate *x, *y;
        !           134: {
        !           135:   int i;
        !           136: 
        !           137:   if (x->h_len != y->h_len)
        !           138:     abort ();
        !           139: 
        !           140:   for (i = 0; i < x->h_len; i++)
        !           141:     {
        !           142:       if (y->v.ansi_harshness[i].code - x->v.ansi_harshness[i].code)
        !           143:        return y->v.ansi_harshness[i].code - x->v.ansi_harshness[i].code;
        !           144:       if ((y->v.ansi_harshness[i].code & STD_CODE)
        !           145:          && (y->v.ansi_harshness[i].distance - x->v.ansi_harshness[i].distance))
        !           146:        return y->v.ansi_harshness[i].distance - x->v.ansi_harshness[i].distance;
        !           147: 
        !           148:       /* They're both the same code.  Now see if we're dealing with an
        !           149:         integral promotion that needs a finer grain of accuracy.  */
        !           150:       if (y->v.ansi_harshness[0].code & PROMO_CODE
        !           151:          && (y->v.ansi_harshness[i].int_penalty ^ x->v.ansi_harshness[i].int_penalty))
        !           152:        return y->v.ansi_harshness[i].int_penalty - x->v.ansi_harshness[i].int_penalty;
        !           153:     }
        !           154:   return 0;
        !           155: }
        !           156: 
        !           157: /* TYPE is the type we wish to convert to.  PARM is the parameter
        !           158:    we have to work with.  We use a somewhat arbitrary cost function
        !           159:    to measure this conversion.  */
        !           160: static struct harshness_code
        !           161: convert_harshness_ansi (type, parmtype, parm)
        !           162:      register tree type, parmtype;
        !           163:      tree parm;
        !           164: {
        !           165:   struct harshness_code h;
        !           166:   register enum tree_code codel;
        !           167:   register enum tree_code coder;
        !           168: 
        !           169:   h.code = 0;
        !           170:   h.distance = 0;
        !           171:   h.int_penalty = 0;
        !           172: 
        !           173: #ifdef GATHER_STATISTICS
        !           174:   n_convert_harshness++;
        !           175: #endif
        !           176: 
        !           177:   if (TYPE_PTRMEMFUNC_P (type))
        !           178:     type = TYPE_PTRMEMFUNC_FN_TYPE (type);
        !           179:   if (TYPE_PTRMEMFUNC_P (parmtype))
        !           180:     parmtype = TYPE_PTRMEMFUNC_FN_TYPE (parmtype);
        !           181: 
        !           182:   codel = TREE_CODE (type);
        !           183:   coder = TREE_CODE (parmtype);
        !           184: 
        !           185:   if (TYPE_MAIN_VARIANT (parmtype) == TYPE_MAIN_VARIANT (type))
        !           186:     return ZERO_RETURN (h);
        !           187: 
        !           188:   if (coder == ERROR_MARK)
        !           189:     return EVIL_RETURN (h);
        !           190: 
        !           191:   if (codel == POINTER_TYPE
        !           192:       && (coder == METHOD_TYPE || coder == FUNCTION_TYPE))
        !           193:     {
        !           194:       tree p1, p2;
        !           195:       struct harshness_code h1, h2;
        !           196: 
        !           197:       /* Get to the METHOD_TYPE or FUNCTION_TYPE that this might be.  */
        !           198:       type = TREE_TYPE (type);
        !           199: 
        !           200:       if (coder != TREE_CODE (type))
        !           201:        return EVIL_RETURN (h);
        !           202: 
        !           203:       /* We allow the default conversion between function type
        !           204:         and pointer-to-function type for free.  */
        !           205:       if (type == parmtype)
        !           206:        return ZERO_RETURN (h);
        !           207: 
        !           208:       /* Compare return types.  */
        !           209:       p1 = TREE_TYPE (type);
        !           210:       p2 = TREE_TYPE (parmtype);
        !           211:       h2 = convert_harshness_ansi (p1, p2, NULL_TREE);
        !           212:       if (h2.code & EVIL_CODE)
        !           213:        return h2;
        !           214: 
        !           215:       h1.code = TRIVIAL_CODE;
        !           216:       h1.distance = 0;
        !           217: 
        !           218:       if (h2.distance != 0)
        !           219:        {
        !           220:          tree binfo;
        !           221: 
        !           222:          /* This only works for pointers.  */
        !           223:          if (TREE_CODE (p1) != POINTER_TYPE
        !           224:              && TREE_CODE (p1) != REFERENCE_TYPE)
        !           225:            return EVIL_RETURN (h);
        !           226: 
        !           227:          p1 = TREE_TYPE (p1);
        !           228:          p2 = TREE_TYPE (p2);
        !           229:          /* Don't die if we happen to be dealing with void*.  */
        !           230:          if (!IS_AGGR_TYPE (p1) || !IS_AGGR_TYPE (p2))
        !           231:            return EVIL_RETURN (h);
        !           232:          if (h2.distance < 0)
        !           233:            binfo = get_binfo (p2, p1, 0);
        !           234:          else
        !           235:            binfo = get_binfo (p1, p2, 0);
        !           236: 
        !           237:          if (! BINFO_OFFSET_ZEROP (binfo))
        !           238:            {
        !           239:              static int explained = 0;
        !           240:              if (h2.distance < 0)
        !           241:                message_2_types (sorry, "cannot cast `%d' to `%d' at function call site", p2, p1);
        !           242:              else
        !           243:                message_2_types (sorry, "cannot cast `%d' to `%d' at function call site", p1, p2);
        !           244: 
        !           245:              if (! explained++)
        !           246:                sorry ("(because pointer values change during conversion)");
        !           247:              return EVIL_RETURN (h);
        !           248:            }
        !           249:        }
        !           250: 
        !           251:       h1.code |= h2.code;
        !           252:       if (h2.distance > h1.distance)
        !           253:        h1.distance = h2.distance;
        !           254: 
        !           255:       p1 = TYPE_ARG_TYPES (type);
        !           256:       p2 = TYPE_ARG_TYPES (parmtype);
        !           257:       while (p1 && TREE_VALUE (p1) != void_type_node
        !           258:             && p2 && TREE_VALUE (p2) != void_type_node)
        !           259:        {
        !           260:          h2 = convert_harshness_ansi (TREE_VALUE (p1), TREE_VALUE (p2),
        !           261:                                       NULL_TREE);
        !           262:          if (h2.code & EVIL_CODE)
        !           263:            return h2;
        !           264: 
        !           265:          if (h2.distance)
        !           266:            {
        !           267:              /* This only works for pointers and references. */
        !           268:              if (TREE_CODE (TREE_VALUE (p1)) != POINTER_TYPE
        !           269:                  && TREE_CODE (TREE_VALUE (p1)) != REFERENCE_TYPE)
        !           270:                return EVIL_RETURN (h);
        !           271:              h2.distance = - h2.distance;
        !           272:            }
        !           273: 
        !           274:          h1.code |= h2.code;
        !           275:          if (h2.distance > h1.distance)
        !           276:            h1.distance = h2.distance;
        !           277:          p1 = TREE_CHAIN (p1);
        !           278:          p2 = TREE_CHAIN (p2);
        !           279:        }
        !           280:       if (p1 == p2)
        !           281:        return h1;
        !           282:       if (p2)
        !           283:        {
        !           284:          if (p1)
        !           285:            return EVIL_RETURN (h);
        !           286:          h1.code |= ELLIPSIS_CODE;
        !           287:          return h1;
        !           288:        }
        !           289:       if (p1)
        !           290:        {
        !           291:          if (TREE_PURPOSE (p1) == NULL_TREE)
        !           292:            h1.code |= EVIL_CODE;
        !           293:          return h1;
        !           294:        }
        !           295:     }
        !           296:   else if (codel == POINTER_TYPE && coder == OFFSET_TYPE)
        !           297:     {
        !           298:       /* Get to the OFFSET_TYPE that this might be.  */
        !           299:       type = TREE_TYPE (type);
        !           300: 
        !           301:       if (coder != TREE_CODE (type))
        !           302:        return EVIL_RETURN (h);
        !           303: 
        !           304:       if (TYPE_OFFSET_BASETYPE (type) == TYPE_OFFSET_BASETYPE (parmtype))
        !           305:        h.code = 0;
        !           306:       else if (UNIQUELY_DERIVED_FROM_P (TYPE_OFFSET_BASETYPE (type),
        !           307:                               TYPE_OFFSET_BASETYPE (parmtype)))
        !           308:        {
        !           309:          h.code = STD_CODE;
        !           310:          h.distance = 1;
        !           311:        }
        !           312:       else if (UNIQUELY_DERIVED_FROM_P (TYPE_OFFSET_BASETYPE (parmtype),
        !           313:                               TYPE_OFFSET_BASETYPE (type)))
        !           314:        {
        !           315:          h.code = STD_CODE;
        !           316:          h.distance = -1;
        !           317:        }
        !           318:       else
        !           319:        return EVIL_RETURN (h);
        !           320:       /* Now test the OFFSET_TYPE's target compatibility.  */
        !           321:       type = TREE_TYPE (type);
        !           322:       parmtype = TREE_TYPE (parmtype);
        !           323:     }
        !           324: 
        !           325:   if (coder == UNKNOWN_TYPE)
        !           326:     {
        !           327:       if (codel == FUNCTION_TYPE
        !           328:          || codel == METHOD_TYPE
        !           329:          || (codel == POINTER_TYPE
        !           330:              && (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE
        !           331:                  || TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE)))
        !           332:        return TRIVIAL_RETURN (h);
        !           333:       return EVIL_RETURN (h);
        !           334:     }
        !           335: 
        !           336:   if (coder == VOID_TYPE)
        !           337:     return EVIL_RETURN (h);
        !           338: 
        !           339:   if (codel == ENUMERAL_TYPE || codel == INTEGER_TYPE)
        !           340:     {
        !           341:       /* Control equivalence of ints an enums.  */
        !           342: 
        !           343:       if (codel == ENUMERAL_TYPE
        !           344:          && flag_int_enum_equivalence == 0)
        !           345:        {
        !           346:          /* Enums can be converted to ints, but not vice-versa.  */
        !           347:          if (coder != ENUMERAL_TYPE
        !           348:              || TYPE_MAIN_VARIANT (type) != TYPE_MAIN_VARIANT (parmtype))
        !           349:            return EVIL_RETURN (h);
        !           350:        }
        !           351: 
        !           352:       /* else enums and ints (almost) freely interconvert.  */
        !           353: 
        !           354:       if (coder == INTEGER_TYPE || coder == ENUMERAL_TYPE)
        !           355:        {
        !           356:          if ((TREE_UNSIGNED (type) ^ TREE_UNSIGNED (parmtype))
        !           357:              || codel != coder
        !           358:              || TYPE_MODE (type) != TYPE_MODE (parmtype))
        !           359:            {
        !           360:              /* Make sure a value-preserving condition [from a smaller type to
        !           361:                 a larger type] is preferred to a possibly value-destroying
        !           362:                 standard conversion [from a larger type to a smaller type].  */
        !           363:              if (TYPE_PRECISION (type) >= TYPE_PRECISION (parmtype))
        !           364:                {
        !           365:                  h.code = PROMO_CODE;
        !           366:                  /* A char, short, wchar_t, etc., should promote to an int if
        !           367:                     it can handle it, otherwise to an unsigned.  So we'll make
        !           368:                     an unsigned.  */
        !           369:                  if (type != integer_type_node)
        !           370:                    h.int_penalty = 1;
        !           371:                }
        !           372:              else
        !           373:                h.code = STD_CODE;
        !           374:            }
        !           375: 
        !           376:          /* If the three above conditions didn't trigger, we have found two
        !           377:             very similar types.  On systems where they're the same size, we
        !           378:             can end up here with TYPE as `long' and PARMTYPE as `int'.  Make
        !           379:             sure we realize that, even though they're the same mode, we will
        !           380:             have to do some sort of integral promotion on the type, since
        !           381:             they're not the same.  */
        !           382:          if (! comptypes (type, parmtype, 1) && h.code == 0)
        !           383:            {
        !           384:              /* This call to common_type will return the best type for the
        !           385:                 combination.  If it matches TYPE, that means we'll be converting
        !           386:                 from a so-called smaller type (in PARMTYPE) to the larger in TYPE,
        !           387:                 thus an integral promotion.  Otherwise, it must be going from a
        !           388:                 larger type in PARMTYPE to a smaller expected type in TYPE, so we
        !           389:                 make it a standard conversion instead.  */
        !           390:              if (common_type (type, parmtype) == type)
        !           391:                h.code = PROMO_CODE;
        !           392:              else
        !           393:                h.code = STD_CODE;
        !           394:            }
        !           395:            
        !           396:          return h;
        !           397:        }
        !           398:       else if (coder == REAL_TYPE)
        !           399:        {
        !           400:          h.code = STD_CODE;
        !           401:          h.distance = 0;
        !           402:          return h;
        !           403:        }
        !           404:     }
        !           405: 
        !           406:   if (codel == REAL_TYPE)
        !           407:     {
        !           408:       if (coder == REAL_TYPE)
        !           409:        {
        !           410:          /* Shun converting between float and double if a choice exists.  */
        !           411:          if (TYPE_MODE (type) != TYPE_MODE (parmtype))
        !           412:            {
        !           413:              h.code = PROMO_CODE;
        !           414:              return h;
        !           415:            }
        !           416:          return ZERO_RETURN (h);
        !           417:        }
        !           418:       else if (coder == INTEGER_TYPE || coder == ENUMERAL_TYPE)
        !           419:        {
        !           420:          h.code = STD_CODE;
        !           421:          h.distance = 0;
        !           422:          return h;
        !           423:        }
        !           424:     }
        !           425: 
        !           426:   /* Convert arrays which have not previously been converted.  */
        !           427:   if (codel == ARRAY_TYPE)
        !           428:     codel = POINTER_TYPE;
        !           429:   if (coder == ARRAY_TYPE)
        !           430:     coder = POINTER_TYPE;
        !           431: 
        !           432:   /* Conversions among pointers */
        !           433:   if (codel == POINTER_TYPE && coder == POINTER_TYPE)
        !           434:     {
        !           435:       register tree ttl = TYPE_MAIN_VARIANT (TREE_TYPE (type));
        !           436:       register tree ttr = TYPE_MAIN_VARIANT (TREE_TYPE (parmtype));
        !           437:       int penalty = 4 * (ttl != ttr);
        !           438: 
        !           439:       /* Anything converts to void *.  void * converts to anything.
        !           440:         Since these may be `const void *' (etc.) use VOID_TYPE
        !           441:         instead of void_type_node.  Otherwise, the targets must be the same,
        !           442:         except that we do allow (at some cost) conversion between signed and
        !           443:         unsinged pointer types.  */
        !           444: 
        !           445:       if ((TREE_CODE (ttl) == METHOD_TYPE
        !           446:           || TREE_CODE (ttl) == FUNCTION_TYPE)
        !           447:          && TREE_CODE (ttl) == TREE_CODE (ttr))
        !           448:        {
        !           449:          if (comptypes (ttl, ttr, -1))
        !           450:            {
        !           451:              h.code = penalty ? STD_CODE : 0;
        !           452:              h.distance =  0;
        !           453:            }
        !           454:          else
        !           455:            h.code = EVIL_CODE;
        !           456:          return h;
        !           457:        }
        !           458: 
        !           459: #if 1
        !           460:       if (TREE_CODE (ttl) != VOID_TYPE && TREE_CODE (ttr) != VOID_TYPE)
        !           461:        {
        !           462:          if (TREE_UNSIGNED (ttl) != TREE_UNSIGNED (ttr))
        !           463:            {
        !           464:              ttl = unsigned_type (ttl);
        !           465:              ttr = unsigned_type (ttr);
        !           466:              penalty = 10;
        !           467:            }
        !           468:          if (! comp_target_types (ttl, ttr, 0))
        !           469:            return EVIL_RETURN (h);
        !           470:        }
        !           471: #else
        !           472:       if (!(TREE_CODE (ttl) == VOID_TYPE
        !           473:            || TREE_CODE (ttr) == VOID_TYPE
        !           474:            || (TREE_UNSIGNED (ttl) ^ TREE_UNSIGNED (ttr)
        !           475:                && (ttl = unsigned_type (ttl),
        !           476:                    ttr = unsigned_type (ttr),
        !           477:                    penalty = 10, 0))
        !           478:            || (comp_target_types (ttl, ttr, 0))))
        !           479:        return EVIL_RETURN (h);
        !           480: #endif
        !           481: 
        !           482:       if (penalty == 10 || ttr == ttl)
        !           483:        {
        !           484:          tree tmp1 = TREE_TYPE (type), tmp2 = TREE_TYPE (parmtype);
        !           485: 
        !           486:          /* If one was unsigned but the other wasn't, then we need to
        !           487:             do a standard conversion from T to unsigned T.  */
        !           488:          if (penalty == 10)
        !           489:            h.code = PROMO_CODE; /* was STD_CODE */
        !           490:          else
        !           491:            h.code = 0;
        !           492: 
        !           493:          /* Note conversion from `T*' to `const T*',
        !           494:                               or `T*' to `volatile T*'.  */
        !           495:          if (ttl == ttr
        !           496:              && ((TYPE_READONLY (tmp1) != TREE_READONLY (tmp2))
        !           497:                  || (TYPE_VOLATILE (tmp1) != TYPE_VOLATILE (tmp2))))
        !           498:            h.code |= QUAL_CODE;
        !           499: 
        !           500:          h.distance = 0;
        !           501:          return h;
        !           502:        }
        !           503: 
        !           504: 
        !           505:       if (TREE_CODE (ttl) == RECORD_TYPE && TREE_CODE (ttr) == RECORD_TYPE)
        !           506:        {
        !           507:          int b_or_d = get_base_distance (ttl, ttr, 0, 0);
        !           508:          if (b_or_d < 0)
        !           509:            {
        !           510:              b_or_d = get_base_distance (ttr, ttl, 0, 0);
        !           511:              if (b_or_d < 0)
        !           512:                return EVIL_RETURN (h);
        !           513:              h.distance = -b_or_d;
        !           514:            }
        !           515:          else
        !           516:            h.distance = b_or_d;
        !           517:          h.code = STD_CODE;
        !           518:          return h;
        !           519:        }
        !           520: 
        !           521:       /* If converting from a `class*' to a `void*', make it
        !           522:         less favorable than any inheritance relationship.  */
        !           523:       if (TREE_CODE (ttl) == VOID_TYPE && IS_AGGR_TYPE (ttr))
        !           524:        {
        !           525:          h.code = STD_CODE;
        !           526:          h.distance = CLASSTYPE_MAX_DEPTH (ttr)+1;
        !           527:          return h;
        !           528:        }
        !           529:       h.code = penalty ? STD_CODE : PROMO_CODE;
        !           530:       return h;
        !           531:     }
        !           532: 
        !           533:   if (codel == POINTER_TYPE && coder == INTEGER_TYPE)
        !           534:     {
        !           535:       /* This is not a bad match, but don't let it beat
        !           536:         integer-enum combinations.  */
        !           537:       if (parm && integer_zerop (parm))
        !           538:        {
        !           539:          h.code = STD_CODE;
        !           540:          h.distance = 0;
        !           541:          return h;
        !           542:        }
        !           543:     }
        !           544: 
        !           545:   /* C++: one of the types must be a reference type.  */
        !           546:   {
        !           547:     tree ttl, ttr;
        !           548:     register tree intype = TYPE_MAIN_VARIANT (parmtype);
        !           549:     register enum tree_code form = TREE_CODE (intype);
        !           550:     int penalty;
        !           551: 
        !           552:     if (codel == REFERENCE_TYPE || coder == REFERENCE_TYPE)
        !           553:       {
        !           554:        ttl = TYPE_MAIN_VARIANT (type);
        !           555: 
        !           556:        if (codel == REFERENCE_TYPE)
        !           557:          {
        !           558:            ttl = TREE_TYPE (ttl);
        !           559: 
        !           560:            /* When passing a non-const argument into a const reference,
        !           561:               dig it a little, so a non-const reference is preferred over
        !           562:               this one. (mrs) */
        !           563:            if (parm && TREE_READONLY (ttl) && ! TREE_READONLY (parm))
        !           564:              penalty = 2;
        !           565:            else
        !           566:              penalty = 0;
        !           567: 
        !           568:            ttl = TYPE_MAIN_VARIANT (ttl);
        !           569: 
        !           570:            if (form == OFFSET_TYPE)
        !           571:              {
        !           572:                intype = TREE_TYPE (intype);
        !           573:                form = TREE_CODE (intype);
        !           574:              }
        !           575: 
        !           576:            if (form == REFERENCE_TYPE)
        !           577:              {
        !           578:                intype = TYPE_MAIN_VARIANT (TREE_TYPE (intype));
        !           579: 
        !           580:                if (ttl == intype)
        !           581:                  return ZERO_RETURN (h);
        !           582:                penalty = 2;
        !           583:              }
        !           584:            else
        !           585:              {
        !           586:                /* Can reference be built up?  */
        !           587:                if (ttl == intype && penalty == 0) {
        !           588:                  /* Because the READONLY and VIRTUAL bits are not always in
        !           589:                     the type, this extra check is necessary.  The problem
        !           590:                     should be fixed someplace else, and this extra code
        !           591:                     removed.
        !           592: 
        !           593:                     Also, if type if a reference, the readonly bits could
        !           594:                     either be in the outer type (with reference) or on the
        !           595:                     inner type (the thing being referenced).  (mrs)  */
        !           596:                  if (parm
        !           597:                      && ((TREE_READONLY (parm)
        !           598:                           && ! (TYPE_READONLY (type)
        !           599:                                 || (TREE_CODE (type) == REFERENCE_TYPE
        !           600:                                     && TYPE_READONLY (TREE_TYPE (type)))))
        !           601:                          || (TREE_SIDE_EFFECTS (parm)
        !           602:                              && ! (TYPE_VOLATILE (type)
        !           603:                                    || (TREE_CODE (type) == REFERENCE_TYPE
        !           604:                                        && TYPE_VOLATILE (TREE_TYPE (type)))))))
        !           605:                    penalty = 2;
        !           606:                  else
        !           607:                    return ZERO_RETURN (h);
        !           608:                }
        !           609:                else
        !           610:                  penalty = 2;
        !           611:              }
        !           612:          }
        !           613:        else if (form == REFERENCE_TYPE)
        !           614:          {
        !           615:            if (parm)
        !           616:              {
        !           617:                tree tmp = convert_from_reference (parm);
        !           618:                intype = TYPE_MAIN_VARIANT (TREE_TYPE (tmp));
        !           619:              }
        !           620:            else
        !           621:              {
        !           622:                intype = parmtype;
        !           623:                do
        !           624:                  intype = TREE_TYPE (intype);
        !           625:                while (TREE_CODE (intype) == REFERENCE_TYPE);
        !           626:                intype = TYPE_MAIN_VARIANT (intype);
        !           627:              }
        !           628: 
        !           629:            if (ttl == intype)
        !           630:              return ZERO_RETURN (h);
        !           631:            else
        !           632:              penalty = 2;
        !           633:          }
        !           634: 
        !           635:        if (TREE_UNSIGNED (ttl) ^ TREE_UNSIGNED (intype))
        !           636:          {
        !           637:            ttl = unsigned_type (ttl);
        !           638:            intype = unsigned_type (intype);
        !           639:            penalty += 2;
        !           640:          }
        !           641: 
        !           642:        ttr = intype;
        !           643: 
        !           644:        /* If the initializer is not an lvalue, then it does not
        !           645:           matter if we make life easier for the programmer
        !           646:           by creating a temporary variable with which to
        !           647:           hold the result.  */
        !           648:        if (parm && (coder == INTEGER_TYPE
        !           649:                     || coder == ENUMERAL_TYPE
        !           650:                     || coder == REAL_TYPE)
        !           651:            && ! lvalue_p (parm))
        !           652:          {
        !           653:            h = convert_harshness_ansi (ttl, ttr, NULL_TREE);
        !           654:            if (penalty)
        !           655:              h.code |= STD_CODE;
        !           656:            h.distance = 0;
        !           657:            return h;
        !           658:          }
        !           659: 
        !           660:        if (ttl == ttr)
        !           661:          {
        !           662:            if (penalty > 2)
        !           663:              {
        !           664:                h.code = STD_CODE;
        !           665:                h.distance = 0;
        !           666:              }
        !           667:            else
        !           668:              {
        !           669:                h.code = TRIVIAL_CODE;
        !           670:                /* We set this here so that build_overload_call_real will be
        !           671:                   able to see the penalty we found, rather than just looking
        !           672:                   at a TRIVIAL_CODE with no other information.  */
        !           673:                h.int_penalty = penalty;
        !           674:              }
        !           675:            return h;
        !           676:          }
        !           677: 
        !           678:        /* Pointers to voids always convert for pointers.  But
        !           679:           make them less natural than more specific matches.  */
        !           680:        if (TREE_CODE (ttl) == POINTER_TYPE && TREE_CODE (ttr) == POINTER_TYPE)
        !           681:          {
        !           682:            if (TREE_TYPE (ttl) == void_type_node
        !           683:                || TREE_TYPE (ttr) == void_type_node)
        !           684:              {
        !           685:                h.code = STD_CODE;
        !           686:                h.distance = 0;
        !           687:                return h;
        !           688:              }
        !           689:          }
        !           690: 
        !           691:        if (parm && codel != REFERENCE_TYPE)
        !           692:          {
        !           693:            h = convert_harshness_ansi (ttl, ttr, NULL_TREE);
        !           694:            if (penalty)
        !           695:              h.code |= STD_CODE;
        !           696:            h.distance = 0;
        !           697:            return h;
        !           698:          }
        !           699: 
        !           700:        /* Here it does matter.  If this conversion is from derived to base,
        !           701:           allow it.  Otherwise, types must be compatible in the strong sense.  */
        !           702:        if (TREE_CODE (ttl) == RECORD_TYPE && TREE_CODE (ttr) == RECORD_TYPE)
        !           703:          {
        !           704:            int b_or_d = get_base_distance (ttl, ttr, 0, 0);
        !           705:            if (b_or_d < 0)
        !           706:              {
        !           707:                b_or_d = get_base_distance (ttr, ttl, 0, 0);
        !           708:                if (b_or_d < 0)
        !           709:                  return EVIL_RETURN (h);
        !           710:                h.distance = -b_or_d;
        !           711:              }
        !           712:            /* Say that this conversion is relatively painless.
        !           713:               If it turns out that there is a user-defined X(X&)
        !           714:               constructor, then that will be invoked, but that's
        !           715:               preferable to dealing with other user-defined conversions
        !           716:               that may produce surprising results.  */
        !           717:            else
        !           718:              h.distance = b_or_d;
        !           719:            h.code = STD_CODE;
        !           720:            return h;
        !           721:          }
        !           722: 
        !           723:        if (comp_target_types (ttl, intype, 1))
        !           724:          {
        !           725:            if (penalty)
        !           726:              h.code = STD_CODE;
        !           727:            h.distance = 0;
        !           728:            return h;
        !           729:          }
        !           730:       }
        !           731:   }
        !           732:   if (codel == RECORD_TYPE && coder == RECORD_TYPE)
        !           733:     {
        !           734:       int b_or_d = get_base_distance (type, parmtype, 0, 0);
        !           735:       if (b_or_d < 0)
        !           736:        {
        !           737:          b_or_d = get_base_distance (parmtype, type, 0, 0);
        !           738:          if (b_or_d < 0)
        !           739:            return EVIL_RETURN (h);
        !           740:          h.distance = -b_or_d;
        !           741:        }
        !           742:       else
        !           743:        h.distance = b_or_d;
        !           744:       h.code = STD_CODE;
        !           745:       return h;
        !           746:     }
        !           747:   return EVIL_RETURN (h);
        !           748: }
        !           749: 
        !           750: /* TYPE is the type we wish to convert to.  PARM is the parameter
        !           751:    we have to work with.  We use a somewhat arbitrary cost function
        !           752:    to measure this conversion.  */
        !           753: static int
        !           754: convert_harshness_old (type, parmtype, parm)
        !           755:      register tree type, parmtype;
        !           756:      tree parm;
        !           757: {
        !           758:   register enum tree_code codel;
        !           759:   register enum tree_code coder;
        !           760: 
        !           761: #ifdef GATHER_STATISTICS
        !           762:   n_convert_harshness++;
        !           763: #endif
        !           764: 
        !           765:   if (TYPE_PTRMEMFUNC_P (type))
        !           766:     type = TYPE_PTRMEMFUNC_FN_TYPE (type);
        !           767:   if (TYPE_PTRMEMFUNC_P (parmtype))
        !           768:     parmtype = TYPE_PTRMEMFUNC_FN_TYPE (parmtype);
        !           769: 
        !           770:   codel = TREE_CODE (type);
        !           771:   coder = TREE_CODE (parmtype);
        !           772: 
        !           773:   if (TYPE_MAIN_VARIANT (parmtype) == TYPE_MAIN_VARIANT (type))
        !           774:     return TRIVIAL;
        !           775: 
        !           776:   if (coder == ERROR_MARK)
        !           777:     return EVIL;
        !           778: 
        !           779:   if (codel == POINTER_TYPE
        !           780:       && (coder == METHOD_TYPE || coder == FUNCTION_TYPE))
        !           781:     {
        !           782:       tree p1, p2;
        !           783:       int harshness, new_harshness;
        !           784: 
        !           785:       /* Get to the METHOD_TYPE or FUNCTION_TYPE that this might be.  */
        !           786:       type = TREE_TYPE (type);
        !           787: 
        !           788:       if (coder != TREE_CODE (type))
        !           789:        return EVIL;
        !           790: 
        !           791:       harshness = 0;
        !           792: 
        !           793:       /* We allow the default conversion between function type
        !           794:         and pointer-to-function type for free.  */
        !           795:       if (type == parmtype)
        !           796:        return TRIVIAL;
        !           797: 
        !           798:       /* Compare return types.  */
        !           799:       p1 = TREE_TYPE (type);
        !           800:       p2 = TREE_TYPE (parmtype);
        !           801:       new_harshness = convert_harshness_old (p1, p2, NULL_TREE);
        !           802:       if (EVIL_HARSHNESS (new_harshness))
        !           803:        return EVIL;
        !           804: 
        !           805:       if (BASE_DERIVED_HARSHNESS (new_harshness))
        !           806:        {
        !           807:          tree binfo;
        !           808: 
        !           809:          /* This only works for pointers.  */
        !           810:          if (TREE_CODE (p1) != POINTER_TYPE
        !           811:              && TREE_CODE (p1) != REFERENCE_TYPE)
        !           812:            return EVIL;
        !           813: 
        !           814:          p1 = TREE_TYPE (p1);
        !           815:          p2 = TREE_TYPE (p2);
        !           816:          /* Don't die if we happen to be dealing with void*.  */
        !           817:          if (!IS_AGGR_TYPE (p1) || !IS_AGGR_TYPE (p2))
        !           818:            return EVIL;
        !           819:          if (CONTRAVARIANT_HARSHNESS (new_harshness))
        !           820:            binfo = get_binfo (p2, p1, 0);
        !           821:          else
        !           822:            binfo = get_binfo (p1, p2, 0);
        !           823: 
        !           824:          if (! BINFO_OFFSET_ZEROP (binfo))
        !           825:            {
        !           826:              static int explained = 0;
        !           827:              if (CONTRAVARIANT_HARSHNESS (new_harshness))
        !           828:                message_2_types (sorry, "cannot cast `%d' to `%d' at function call site", p2, p1);
        !           829:              else
        !           830:                message_2_types (sorry, "cannot cast `%d' to `%d' at function call site", p1, p2);
        !           831: 
        !           832:              if (! explained++)
        !           833:                sorry ("(because pointer values change during conversion)");
        !           834:              return EVIL;
        !           835:            }
        !           836:        }
        !           837: 
        !           838:       harshness |= new_harshness;
        !           839: 
        !           840:       p1 = TYPE_ARG_TYPES (type);
        !           841:       p2 = TYPE_ARG_TYPES (parmtype);
        !           842:       while (p1 && TREE_VALUE (p1) != void_type_node
        !           843:             && p2 && TREE_VALUE (p2) != void_type_node)
        !           844:        {
        !           845:          new_harshness = convert_harshness_old (TREE_VALUE (p1),
        !           846:                                                 TREE_VALUE (p2), NULL_TREE);
        !           847:          if (EVIL_HARSHNESS (new_harshness))
        !           848:            return EVIL;
        !           849: 
        !           850:          if (BASE_DERIVED_HARSHNESS (new_harshness))
        !           851:            {
        !           852:              /* This only works for pointers and references. */
        !           853:              if (TREE_CODE (TREE_VALUE (p1)) != POINTER_TYPE
        !           854:                  && TREE_CODE (TREE_VALUE (p1)) != REFERENCE_TYPE)
        !           855:                return EVIL;
        !           856:              new_harshness ^= CONTRAVARIANT_HARSHNESS (new_harshness);
        !           857:              harshness |= new_harshness;
        !           858:            }
        !           859:          /* This trick allows use to accumulate easy type
        !           860:             conversions without messing up the bits that encode
        !           861:             info about more involved things.  */
        !           862:          else if (ONLY_EASY_HARSHNESS (new_harshness))
        !           863:            harshness += new_harshness;
        !           864:          else
        !           865:            harshness |= new_harshness;
        !           866:          p1 = TREE_CHAIN (p1);
        !           867:          p2 = TREE_CHAIN (p2);
        !           868:        }
        !           869:       if (p1 == p2)
        !           870:        return harshness;
        !           871:       if (p2)
        !           872:        return p1 ? EVIL : (harshness | ELLIPSIS_HARSHNESS (-1));
        !           873:       if (p1)
        !           874:        return harshness | (TREE_PURPOSE (p1) == NULL_TREE);
        !           875:     }
        !           876:   else if (codel == POINTER_TYPE && coder == OFFSET_TYPE)
        !           877:     {
        !           878:       /* XXX: Note this is set a few times, but it's never actually
        !           879:         used! (bpk) */
        !           880:       int harshness;
        !           881: 
        !           882:       /* Get to the OFFSET_TYPE that this might be.  */
        !           883:       type = TREE_TYPE (type);
        !           884: 
        !           885:       if (coder != TREE_CODE (type))
        !           886:        return EVIL;
        !           887: 
        !           888:       harshness = 0;
        !           889: 
        !           890:       if (TYPE_OFFSET_BASETYPE (type) == TYPE_OFFSET_BASETYPE (parmtype))
        !           891:        harshness = 0;
        !           892:       else if (UNIQUELY_DERIVED_FROM_P (TYPE_OFFSET_BASETYPE (type),
        !           893:                               TYPE_OFFSET_BASETYPE (parmtype)))
        !           894:        harshness = INT_TO_BD_HARSHNESS (1);
        !           895:       else if (UNIQUELY_DERIVED_FROM_P (TYPE_OFFSET_BASETYPE (parmtype),
        !           896:                               TYPE_OFFSET_BASETYPE (type)))
        !           897:        harshness = CONTRAVARIANT_HARSHNESS (-1);
        !           898:       else
        !           899:        return EVIL;
        !           900:       /* Now test the OFFSET_TYPE's target compatibility.  */
        !           901:       type = TREE_TYPE (type);
        !           902:       parmtype = TREE_TYPE (parmtype);
        !           903:     }
        !           904: 
        !           905:   if (coder == UNKNOWN_TYPE)
        !           906:     {
        !           907:       if (codel == FUNCTION_TYPE
        !           908:          || codel == METHOD_TYPE
        !           909:          || (codel == POINTER_TYPE
        !           910:              && (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE
        !           911:                  || TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE)))
        !           912:        return TRIVIAL;
        !           913:       return EVIL;
        !           914:     }
        !           915: 
        !           916:   if (coder == VOID_TYPE)
        !           917:     return EVIL;
        !           918: 
        !           919:   if (codel == ENUMERAL_TYPE || codel == INTEGER_TYPE)
        !           920:     {
        !           921:       /* Control equivalence of ints an enums.  */
        !           922: 
        !           923:       if (codel == ENUMERAL_TYPE
        !           924:          && flag_int_enum_equivalence == 0)
        !           925:        {
        !           926:          /* Enums can be converted to ints, but not vice-versa.  */
        !           927:          if (coder != ENUMERAL_TYPE
        !           928:              || TYPE_MAIN_VARIANT (type) != TYPE_MAIN_VARIANT (parmtype))
        !           929:            return EVIL;
        !           930:        }
        !           931: 
        !           932:       /* else enums and ints (almost) freely interconvert.  */
        !           933: 
        !           934:       if (coder == INTEGER_TYPE || coder == ENUMERAL_TYPE)
        !           935:        {
        !           936:          int easy = TREE_UNSIGNED (type) ^ TREE_UNSIGNED (parmtype);
        !           937:          if (codel != coder)
        !           938:            easy += 1;
        !           939:          if (TYPE_MODE (type) != TYPE_MODE (parmtype))
        !           940:            easy += 2;
        !           941:          return INT_TO_EASY_HARSHNESS (easy);
        !           942:        }
        !           943:       else if (coder == REAL_TYPE)
        !           944:        return INT_TO_EASY_HARSHNESS (4);
        !           945:     }
        !           946: 
        !           947:   if (codel == REAL_TYPE)
        !           948:     if (coder == REAL_TYPE)
        !           949:       /* Shun converting between float and double if a choice exists.  */
        !           950:       {
        !           951:        if (TYPE_MODE (type) != TYPE_MODE (parmtype))
        !           952:          return INT_TO_EASY_HARSHNESS (2);
        !           953:        return TRIVIAL;
        !           954:       }
        !           955:     else if (coder == INTEGER_TYPE || coder == ENUMERAL_TYPE)
        !           956:       return INT_TO_EASY_HARSHNESS (4);
        !           957: 
        !           958:   /* convert arrays which have not previously been converted.  */
        !           959:   if (codel == ARRAY_TYPE)
        !           960:     codel = POINTER_TYPE;
        !           961:   if (coder == ARRAY_TYPE)
        !           962:     coder = POINTER_TYPE;
        !           963: 
        !           964:   /* Conversions among pointers */
        !           965:   if (codel == POINTER_TYPE && coder == POINTER_TYPE)
        !           966:     {
        !           967:       register tree ttl = TYPE_MAIN_VARIANT (TREE_TYPE (type));
        !           968:       register tree ttr = TYPE_MAIN_VARIANT (TREE_TYPE (parmtype));
        !           969:       int penalty = 4 * (ttl != ttr);
        !           970:       /* Anything converts to void *.  void * converts to anything.
        !           971:         Since these may be `const void *' (etc.) use VOID_TYPE
        !           972:         instead of void_type_node.
        !           973:         Otherwise, the targets must be the same,
        !           974:         except that we do allow (at some cost) conversion
        !           975:         between signed and unsinged pointer types.  */
        !           976: 
        !           977:       if ((TREE_CODE (ttl) == METHOD_TYPE
        !           978:           || TREE_CODE (ttl) == FUNCTION_TYPE)
        !           979:          && TREE_CODE (ttl) == TREE_CODE (ttr))
        !           980:        {
        !           981:          if (comptypes (ttl, ttr, -1))
        !           982:            return INT_TO_EASY_HARSHNESS (penalty);
        !           983:          return EVIL;
        !           984:        }
        !           985: 
        !           986:       if (!(TREE_CODE (ttl) == VOID_TYPE
        !           987:            || TREE_CODE (ttr) == VOID_TYPE
        !           988:            || (TREE_UNSIGNED (ttl) ^ TREE_UNSIGNED (ttr)
        !           989:                && (ttl = unsigned_type (ttl),
        !           990:                    ttr = unsigned_type (ttr),
        !           991:                    penalty = 10, 0))
        !           992:            || (comp_target_types (ttl, ttr, 0))))
        !           993:        return EVIL;
        !           994: 
        !           995:       if (penalty == 10)
        !           996:        return INT_TO_EASY_HARSHNESS (10);
        !           997:       if (ttr == ttl)
        !           998:        return INT_TO_BD_HARSHNESS (0);
        !           999: 
        !          1000:       if (TREE_CODE (ttl) == RECORD_TYPE && TREE_CODE (ttr) == RECORD_TYPE)
        !          1001:        {
        !          1002:          int b_or_d = get_base_distance (ttl, ttr, 0, 0);
        !          1003:          if (b_or_d < 0)
        !          1004:            {
        !          1005:              b_or_d = get_base_distance (ttr, ttl, 0, 0);
        !          1006:              if (b_or_d < 0)
        !          1007:                return EVIL;
        !          1008:              return CONTRAVARIANT_HARSHNESS (-1);
        !          1009:            }
        !          1010:          return INT_TO_BD_HARSHNESS (b_or_d);
        !          1011:        }
        !          1012:       /* If converting from a `class*' to a `void*', make it
        !          1013:         less favorable than any inheritance relationship.  */
        !          1014:       if (TREE_CODE (ttl) == VOID_TYPE && IS_AGGR_TYPE (ttr))
        !          1015:        return INT_TO_BD_HARSHNESS (CLASSTYPE_MAX_DEPTH (ttr)+1);
        !          1016:       return INT_TO_EASY_HARSHNESS (penalty);
        !          1017:     }
        !          1018: 
        !          1019:   if (codel == POINTER_TYPE && coder == INTEGER_TYPE)
        !          1020:     {
        !          1021:       /* This is not a bad match, but don't let it beat
        !          1022:         integer-enum combinations.  */
        !          1023:       if (parm && integer_zerop (parm))
        !          1024:        return INT_TO_EASY_HARSHNESS (4);
        !          1025:     }
        !          1026: 
        !          1027:   /* C++: one of the types must be a reference type.  */
        !          1028:   {
        !          1029:     tree ttl, ttr;
        !          1030:     register tree intype = TYPE_MAIN_VARIANT (parmtype);
        !          1031:     register enum tree_code form = TREE_CODE (intype);
        !          1032:     int penalty;
        !          1033: 
        !          1034:     if (codel == REFERENCE_TYPE || coder == REFERENCE_TYPE)
        !          1035:       {
        !          1036:        ttl = TYPE_MAIN_VARIANT (type);
        !          1037: 
        !          1038:        if (codel == REFERENCE_TYPE)
        !          1039:          {
        !          1040:            ttl = TREE_TYPE (ttl);
        !          1041: 
        !          1042:            /* When passing a non-const argument into a const reference,
        !          1043:               dig it a little, so a non-const reference is preferred over
        !          1044:               this one. (mrs) */
        !          1045:            if (parm && TREE_READONLY (ttl) && ! TREE_READONLY (parm))
        !          1046:              penalty = 2;
        !          1047:            else
        !          1048:              penalty = 0;
        !          1049: 
        !          1050:            ttl = TYPE_MAIN_VARIANT (ttl);
        !          1051: 
        !          1052:            if (form == OFFSET_TYPE)
        !          1053:              {
        !          1054:                intype = TREE_TYPE (intype);
        !          1055:                form = TREE_CODE (intype);
        !          1056:              }
        !          1057: 
        !          1058:            if (form == REFERENCE_TYPE)
        !          1059:              {
        !          1060:                intype = TYPE_MAIN_VARIANT (TREE_TYPE (intype));
        !          1061: 
        !          1062:                if (ttl == intype)
        !          1063:                  return TRIVIAL;
        !          1064:                penalty = 2;
        !          1065:              }
        !          1066:            else
        !          1067:              {
        !          1068:                /* Can reference be built up?  */
        !          1069:                if (ttl == intype && penalty == 0) {
        !          1070:                  /* Because the READONLY bits and VIRTUAL bits are not always
        !          1071:                     in the type, this extra check is necessary.  The problem
        !          1072:                     should be fixed someplace else, and this extra code
        !          1073:                     removed.
        !          1074: 
        !          1075:                     Also, if type if a reference, the readonly bits could
        !          1076:                     either be in the outer type (with reference) or on the
        !          1077:                     inner type (the thing being referenced).  (mrs)  */
        !          1078:                  if (parm
        !          1079:                      && ((TREE_READONLY (parm)
        !          1080:                           && ! (TYPE_READONLY (type)
        !          1081:                                 || (TREE_CODE (type) == REFERENCE_TYPE
        !          1082:                                     && TYPE_READONLY (TREE_TYPE (type)))))
        !          1083:                          || (TREE_SIDE_EFFECTS (parm)
        !          1084:                              && ! (TYPE_VOLATILE (type)
        !          1085:                                    || (TREE_CODE (type) == REFERENCE_TYPE
        !          1086:                                        && TYPE_VOLATILE (TREE_TYPE (type)))))))
        !          1087:                    penalty = 2;
        !          1088:                  else
        !          1089:                    return TRIVIAL;
        !          1090:                }
        !          1091:                else
        !          1092:                  penalty = 2;
        !          1093:              }
        !          1094:          }
        !          1095:        else if (form == REFERENCE_TYPE)
        !          1096:          {
        !          1097:            if (parm)
        !          1098:              {
        !          1099:                tree tmp = convert_from_reference (parm);
        !          1100:                intype = TYPE_MAIN_VARIANT (TREE_TYPE (tmp));
        !          1101:              }
        !          1102:            else
        !          1103:              {
        !          1104:                intype = parmtype;
        !          1105:                do
        !          1106:                  {
        !          1107:                    intype = TREE_TYPE (intype);
        !          1108:                  }
        !          1109:                while (TREE_CODE (intype) == REFERENCE_TYPE);
        !          1110:                intype = TYPE_MAIN_VARIANT (intype);
        !          1111:              }
        !          1112: 
        !          1113:            if (ttl == intype)
        !          1114:              return TRIVIAL;
        !          1115:            else
        !          1116:              penalty = 2;
        !          1117:          }
        !          1118: 
        !          1119:        if (TREE_UNSIGNED (ttl) ^ TREE_UNSIGNED (intype))
        !          1120:          {
        !          1121:            ttl = unsigned_type (ttl);
        !          1122:            intype = unsigned_type (intype);
        !          1123:            penalty += 2;
        !          1124:          }
        !          1125: 
        !          1126:        ttr = intype;
        !          1127: 
        !          1128:        /* If the initializer is not an lvalue, then it does not
        !          1129:           matter if we make life easier for the programmer
        !          1130:           by creating a temporary variable with which to
        !          1131:           hold the result.  */
        !          1132:        if (parm && (coder == INTEGER_TYPE
        !          1133:                     || coder == ENUMERAL_TYPE
        !          1134:                     || coder == REAL_TYPE)
        !          1135:            && ! lvalue_p (parm))
        !          1136:          return (convert_harshness_old (ttl, ttr, NULL_TREE)
        !          1137:                  | INT_TO_EASY_HARSHNESS (penalty));
        !          1138: 
        !          1139:        if (ttl == ttr)
        !          1140:          {
        !          1141:            if (penalty)
        !          1142:              return INT_TO_EASY_HARSHNESS (penalty);
        !          1143:            return INT_TO_BD_HARSHNESS (0);
        !          1144:          }
        !          1145: 
        !          1146:        /* Pointers to voids always convert for pointers.  But
        !          1147:           make them less natural than more specific matches.  */
        !          1148:        if (TREE_CODE (ttl) == POINTER_TYPE && TREE_CODE (ttr) == POINTER_TYPE)
        !          1149:          if (TREE_TYPE (ttl) == void_type_node
        !          1150:              || TREE_TYPE (ttr) == void_type_node)
        !          1151:            return INT_TO_EASY_HARSHNESS (penalty+1);
        !          1152: 
        !          1153:        if (parm && codel != REFERENCE_TYPE)
        !          1154:          return (convert_harshness_old (ttl, ttr, NULL_TREE)
        !          1155:                  | INT_TO_EASY_HARSHNESS (penalty));
        !          1156: 
        !          1157:        /* Here it does matter.  If this conversion is from
        !          1158:           derived to base, allow it.  Otherwise, types must
        !          1159:           be compatible in the strong sense.  */
        !          1160:        if (TREE_CODE (ttl) == RECORD_TYPE && TREE_CODE (ttr) == RECORD_TYPE)
        !          1161:          {
        !          1162:            int b_or_d = get_base_distance (ttl, ttr, 0, 0);
        !          1163:            if (b_or_d < 0)
        !          1164:              {
        !          1165:                b_or_d = get_base_distance (ttr, ttl, 0, 0);
        !          1166:                if (b_or_d < 0)
        !          1167:                  return EVIL;
        !          1168:                return CONTRAVARIANT_HARSHNESS (-1);
        !          1169:              }
        !          1170:            /* Say that this conversion is relatively painless.
        !          1171:               If it turns out that there is a user-defined X(X&)
        !          1172:               constructor, then that will be invoked, but that's
        !          1173:               preferable to dealing with other user-defined conversions
        !          1174:               that may produce surprising results.  */
        !          1175:            return INT_TO_BD_HARSHNESS (b_or_d);
        !          1176:          }
        !          1177: 
        !          1178:        if (comp_target_types (ttl, intype, 1))
        !          1179:          return INT_TO_EASY_HARSHNESS (penalty);
        !          1180:       }
        !          1181:   }
        !          1182:   if (codel == RECORD_TYPE && coder == RECORD_TYPE)
        !          1183:     {
        !          1184:       int b_or_d = get_base_distance (type, parmtype, 0, 0);
        !          1185:       if (b_or_d < 0)
        !          1186:        {
        !          1187:          b_or_d = get_base_distance (parmtype, type, 0, 0);
        !          1188:          if (b_or_d < 0)
        !          1189:            return EVIL;
        !          1190:          return CONTRAVARIANT_HARSHNESS (-1);
        !          1191:        }
        !          1192:       return INT_TO_BD_HARSHNESS (b_or_d);
        !          1193:     }
        !          1194:   return EVIL;
        !          1195: }
        !          1196: 
        !          1197: /* Algorithm: For each argument, calculate how difficult it is to
        !          1198:    make FUNCTION accept that argument.  If we can easily tell that
        !          1199:    FUNCTION won't be acceptable to one of the arguments, then we
        !          1200:    don't need to compute the ease of converting the other arguments,
        !          1201:    since it will never show up in the intersection of all arguments'
        !          1202:    favorite functions.
        !          1203: 
        !          1204:    Conversions between builtin and user-defined types are allowed, but
        !          1205:    no function involving such a conversion is preferred to one which
        !          1206:    does not require such a conversion.  Furthermore, such conversions
        !          1207:    must be unique.  */
        !          1208: 
        !          1209: void
        !          1210: compute_conversion_costs_ansi (function, tta_in, cp, arglen)
        !          1211:      tree function;
        !          1212:      tree tta_in;
        !          1213:      struct candidate *cp;
        !          1214:      int arglen;
        !          1215: {
        !          1216:   tree ttf_in = TYPE_ARG_TYPES (TREE_TYPE (function));
        !          1217:   tree ttf = ttf_in;
        !          1218:   tree tta = tta_in;
        !          1219: 
        !          1220:   /* Start out with no strikes against.  */
        !          1221:   int evil_strikes = 0;
        !          1222:   int ellipsis_strikes = 0;
        !          1223:   int user_strikes = 0;
        !          1224:   int b_or_d_strikes = 0;
        !          1225:   int easy_strikes = 0;
        !          1226: 
        !          1227:   int strike_index = 0, win;
        !          1228:   struct harshness_code lose;
        !          1229: 
        !          1230: #ifdef GATHER_STATISTICS
        !          1231:   n_compute_conversion_costs++;
        !          1232: #endif
        !          1233: 
        !          1234:   cp->function = function;
        !          1235:   cp->arg = tta ? TREE_VALUE (tta) : NULL_TREE;
        !          1236:   cp->u.bad_arg = 0;           /* optimistic!  */
        !          1237: 
        !          1238:   cp->h.code = 0;
        !          1239:   cp->h.distance = 0;
        !          1240:   cp->h.int_penalty = 0;
        !          1241:   bzero (cp->v.ansi_harshness, (arglen+1) * sizeof (short));
        !          1242: 
        !          1243:   while (ttf && tta)
        !          1244:     {
        !          1245:       struct harshness_code h;
        !          1246: 
        !          1247:       if (ttf == void_list_node)
        !          1248:        break;
        !          1249: 
        !          1250:       if (type_unknown_p (TREE_VALUE (tta)))
        !          1251:        {         
        !          1252:          /* Must perform some instantiation here.  */
        !          1253:          tree rhs = TREE_VALUE (tta);
        !          1254:          tree lhstype = TREE_VALUE (ttf);
        !          1255: 
        !          1256:          /* Keep quiet about possible contravariance violations.  */
        !          1257:          int old_inhibit_warnings = inhibit_warnings;
        !          1258:          inhibit_warnings = 1;
        !          1259: 
        !          1260:          /* @@ This is to undo what `grokdeclarator' does to
        !          1261:             parameter types.  It really should go through
        !          1262:             something more general.  */
        !          1263: 
        !          1264:          TREE_TYPE (tta) = unknown_type_node;
        !          1265:          rhs = instantiate_type (lhstype, rhs, 0);
        !          1266:          inhibit_warnings = old_inhibit_warnings;
        !          1267: 
        !          1268:          if (TREE_CODE (rhs) == ERROR_MARK)
        !          1269:            h.code = EVIL_CODE;
        !          1270:          else
        !          1271:            h = convert_harshness_ansi (lhstype, TREE_TYPE (rhs), rhs);
        !          1272:        }
        !          1273:       else
        !          1274:        h = convert_harshness_ansi (TREE_VALUE (ttf),
        !          1275:                                    TREE_TYPE (TREE_VALUE (tta)),
        !          1276:                                    TREE_VALUE (tta));
        !          1277: 
        !          1278:       cp->v.ansi_harshness[strike_index] = h;
        !          1279:       if ((h.code & EVIL_CODE)
        !          1280:          || ((h.code & STD_CODE) && h.distance < 0))
        !          1281:        {
        !          1282:          cp->u.bad_arg = strike_index;
        !          1283:          evil_strikes = 1;
        !          1284:        }
        !          1285:      else if (h.code & ELLIPSIS_CODE)
        !          1286:        ellipsis_strikes += 1;
        !          1287: #if 0
        !          1288:       /* This is never set by `convert_harshness_ansi'.  */
        !          1289:       else if (h.code & USER_CODE)
        !          1290:        {
        !          1291:          user_strikes += 1;
        !          1292:        }
        !          1293: #endif
        !          1294:       else
        !          1295:        {
        !          1296:          if ((h.code & STD_CODE) && h.distance)
        !          1297:            {
        !          1298:              if (h.distance > b_or_d_strikes)
        !          1299:                b_or_d_strikes = h.distance;
        !          1300:            }
        !          1301:          else
        !          1302:            easy_strikes += (h.code & (STD_CODE|PROMO_CODE|TRIVIAL_CODE));
        !          1303:          cp->h.code |= h.code;
        !          1304:          /* Make sure we communicate this.  */
        !          1305:          cp->h.int_penalty += h.int_penalty;
        !          1306:        }
        !          1307: 
        !          1308:       ttf = TREE_CHAIN (ttf);
        !          1309:       tta = TREE_CHAIN (tta);
        !          1310:       strike_index += 1;
        !          1311:     }
        !          1312: 
        !          1313:   if (tta)
        !          1314:     {
        !          1315:       /* ran out of formals, and parmlist is fixed size.  */
        !          1316:       if (ttf /* == void_type_node */)
        !          1317:        {
        !          1318:          cp->h.code = EVIL_CODE;
        !          1319:          cp->u.bad_arg = -1;
        !          1320:          return;
        !          1321:        }
        !          1322:       else
        !          1323:        ellipsis_strikes += list_length (tta);
        !          1324:     }
        !          1325:   else if (ttf && ttf != void_list_node)
        !          1326:     {
        !          1327:       /* ran out of actuals, and no defaults.  */
        !          1328:       if (TREE_PURPOSE (ttf) == NULL_TREE)
        !          1329:        {
        !          1330:          cp->h.code = EVIL_CODE;
        !          1331:          cp->u.bad_arg = -2;
        !          1332:          return;
        !          1333:        }
        !          1334:       /* Store index of first default.  */
        !          1335:       cp->v.ansi_harshness[arglen].distance = strike_index+1;
        !          1336:     }
        !          1337:   else
        !          1338:     cp->v.ansi_harshness[arglen].distance = 0;
        !          1339: 
        !          1340:   /* Argument list lengths work out, so don't need to check them again.  */
        !          1341:   if (evil_strikes)
        !          1342:     {
        !          1343:       /* We do not check for derived->base conversions here, since in
        !          1344:         no case would they give evil strike counts, unless such conversions
        !          1345:         are somehow ambiguous.  */
        !          1346: 
        !          1347:       /* See if any user-defined conversions apply.
        !          1348:          But make sure that we do not loop.  */
        !          1349:       static int dont_convert_types = 0;
        !          1350: 
        !          1351:       if (dont_convert_types)
        !          1352:        {
        !          1353:          cp->h.code = EVIL_CODE;
        !          1354:          return;
        !          1355:        }
        !          1356: 
        !          1357:       win = 0;                 /* Only get one chance to win.  */
        !          1358:       ttf = TYPE_ARG_TYPES (TREE_TYPE (function));
        !          1359:       tta = tta_in;
        !          1360:       strike_index = 0;
        !          1361:       evil_strikes = 0;
        !          1362: 
        !          1363:       while (ttf && tta)
        !          1364:        {
        !          1365:          if (ttf == void_list_node)
        !          1366:            break;
        !          1367: 
        !          1368:          lose = cp->v.ansi_harshness[strike_index];
        !          1369:          if ((lose.code & EVIL_CODE)
        !          1370:              || ((lose.code & STD_CODE) && lose.distance < 0))
        !          1371:            {
        !          1372:              tree actual_type = TREE_TYPE (TREE_VALUE (tta));
        !          1373:              tree formal_type = TREE_VALUE (ttf);
        !          1374: 
        !          1375:              dont_convert_types = 1;
        !          1376: 
        !          1377:              if (TREE_CODE (formal_type) == REFERENCE_TYPE)
        !          1378:                formal_type = TREE_TYPE (formal_type);
        !          1379:              if (TREE_CODE (actual_type) == REFERENCE_TYPE)
        !          1380:                actual_type = TREE_TYPE (actual_type);
        !          1381: 
        !          1382:              if (formal_type != error_mark_node
        !          1383:                  && actual_type != error_mark_node)
        !          1384:                {
        !          1385:                  formal_type = TYPE_MAIN_VARIANT (formal_type);
        !          1386:                  actual_type = TYPE_MAIN_VARIANT (actual_type);
        !          1387: 
        !          1388:                  if (TYPE_HAS_CONSTRUCTOR (formal_type))
        !          1389:                    {
        !          1390:                      /* If it has a constructor for this type,
        !          1391:                         try to use it.  */
        !          1392:                      /* @@ There is no way to save this result yet, so
        !          1393:                         success is a NULL_TREE for now.  */
        !          1394:                      if (convert_to_aggr (formal_type, TREE_VALUE (tta), 0, 1)
        !          1395:                          != error_mark_node)
        !          1396:                        win++;
        !          1397:                    }
        !          1398:                  if (TYPE_LANG_SPECIFIC (actual_type)
        !          1399:                      && TYPE_HAS_CONVERSION (actual_type))
        !          1400:                    {
        !          1401:                      if (TREE_CODE (formal_type) == INTEGER_TYPE
        !          1402:                          && TYPE_HAS_INT_CONVERSION (actual_type))
        !          1403:                        win++;
        !          1404:                      else if (TREE_CODE (formal_type) == REAL_TYPE
        !          1405:                               && TYPE_HAS_REAL_CONVERSION (actual_type))
        !          1406:                        win++;
        !          1407:                      else
        !          1408:                        {
        !          1409:                          tree conv;
        !          1410:                          /* Don't issue warnings since we're only groping
        !          1411:                             around for the right answer, we haven't yet
        !          1412:                             committed to going with this solution.  */
        !          1413:                          int old_inhibit_warnings = inhibit_warnings;
        !          1414: 
        !          1415:                          inhibit_warnings = 1;
        !          1416:                          conv = build_type_conversion (CALL_EXPR, TREE_VALUE (ttf), TREE_VALUE (tta), 0);
        !          1417:                          inhibit_warnings = old_inhibit_warnings;
        !          1418: 
        !          1419:                          if (conv)
        !          1420:                            {
        !          1421:                              if (conv == error_mark_node)
        !          1422:                                win += 2;
        !          1423:                              else
        !          1424:                                win++;
        !          1425:                            }
        !          1426:                          else if (TREE_CODE (TREE_VALUE (ttf)) == REFERENCE_TYPE)
        !          1427:                            {
        !          1428:                              conv = build_type_conversion (CALL_EXPR, formal_type, TREE_VALUE (tta), 0);
        !          1429:                              if (conv)
        !          1430:                                {
        !          1431:                                  if (conv == error_mark_node)
        !          1432:                                    win += 2;
        !          1433:                                  else
        !          1434:                                    win++;
        !          1435:                                }
        !          1436:                            }
        !          1437:                        }
        !          1438:                    }
        !          1439:                }
        !          1440:              dont_convert_types = 0;
        !          1441: 
        !          1442:              if (win == 1)
        !          1443:                {
        !          1444:                  user_strikes += 1;
        !          1445:                  cp->v.ansi_harshness[strike_index].code = USER_CODE;
        !          1446:                  win = 0;
        !          1447:                }
        !          1448:              else
        !          1449:                {
        !          1450:                  if (cp->u.bad_arg > strike_index)
        !          1451:                    cp->u.bad_arg = strike_index;
        !          1452: 
        !          1453:                  evil_strikes = win ? 2 : 1;
        !          1454:                  break;
        !          1455:                }
        !          1456:            }
        !          1457: 
        !          1458:          ttf = TREE_CHAIN (ttf);
        !          1459:          tta = TREE_CHAIN (tta);
        !          1460:          strike_index += 1;
        !          1461:        }
        !          1462:     }
        !          1463: 
        !          1464:   /* Const member functions get a small penalty because defaulting
        !          1465:      to const is less useful than defaulting to non-const. */
        !          1466:   /* This is bogus, it does not correspond to anything in the ARM.
        !          1467:      This code will be fixed when this entire section is rewritten
        !          1468:      to conform to the ARM.  (mrs)  */
        !          1469:   if (TREE_CODE (TREE_TYPE (function)) == METHOD_TYPE)
        !          1470:     {
        !          1471:       if (TYPE_READONLY (TREE_TYPE (TREE_VALUE (ttf_in))))
        !          1472:        {
        !          1473:          cp->v.ansi_harshness[0].code |= TRIVIAL_CODE;
        !          1474:          ++easy_strikes;
        !          1475:        }
        !          1476:       else
        !          1477:        {
        !          1478:          /* Calling a non-const member function from a const member function
        !          1479:             is probably invalid, but for now we let it only draw a warning.
        !          1480:             We indicate that such a mismatch has occurred by setting the
        !          1481:             harshness to a maximum value.  */
        !          1482:          if (TREE_CODE (TREE_TYPE (TREE_VALUE (tta_in))) == POINTER_TYPE
        !          1483:              && (TYPE_READONLY (TREE_TYPE (TREE_TYPE (TREE_VALUE (tta_in))))))
        !          1484:            cp->v.ansi_harshness[0].code |= CONST_CODE;
        !          1485:        }
        !          1486:     }
        !          1487: 
        !          1488:   if (evil_strikes)
        !          1489:     cp->h.code = EVIL_CODE;
        !          1490:   if (ellipsis_strikes)
        !          1491:     cp->h.code |= ELLIPSIS_CODE;
        !          1492:   if (user_strikes)
        !          1493:     cp->h.code |= USER_CODE;
        !          1494: }
        !          1495: 
        !          1496: void
        !          1497: compute_conversion_costs_old (function, tta_in, cp, arglen)
        !          1498:      tree function;
        !          1499:      tree tta_in;
        !          1500:      struct candidate *cp;
        !          1501:      int arglen;
        !          1502: {
        !          1503:   tree ttf_in = TYPE_ARG_TYPES (TREE_TYPE (function));
        !          1504:   tree ttf = ttf_in;
        !          1505:   tree tta = tta_in;
        !          1506: 
        !          1507:   /* Start out with no strikes against.  */
        !          1508:   int evil_strikes = 0;
        !          1509:   int ellipsis_strikes = 0;
        !          1510:   int user_strikes = 0;
        !          1511:   int b_or_d_strikes = 0;
        !          1512:   int easy_strikes = 0;
        !          1513: 
        !          1514:   int strike_index = 0, win, lose;
        !          1515: 
        !          1516: #ifdef GATHER_STATISTICS
        !          1517:   n_compute_conversion_costs++;
        !          1518: #endif
        !          1519: 
        !          1520:   cp->function = function;
        !          1521:   cp->arg = tta ? TREE_VALUE (tta) : NULL_TREE;
        !          1522:   cp->u.bad_arg = 0;           /* optimistic!  */
        !          1523: 
        !          1524:   bzero (cp->v.old_harshness, (arglen+1) * sizeof (short));
        !          1525: 
        !          1526:   while (ttf && tta)
        !          1527:     {
        !          1528:       int harshness;
        !          1529: 
        !          1530:       if (ttf == void_list_node)
        !          1531:        break;
        !          1532: 
        !          1533:       if (type_unknown_p (TREE_VALUE (tta)))
        !          1534:        {         
        !          1535:          /* Must perform some instantiation here.  */
        !          1536:          tree rhs = TREE_VALUE (tta);
        !          1537:          tree lhstype = TREE_VALUE (ttf);
        !          1538: 
        !          1539:          /* Keep quiet about possible contravariance violations.  */
        !          1540:          int old_inhibit_warnings = inhibit_warnings;
        !          1541:          inhibit_warnings = 1;
        !          1542: 
        !          1543:          /* @@ This is to undo what `grokdeclarator' does to
        !          1544:             parameter types.  It really should go through
        !          1545:             something more general.  */
        !          1546: 
        !          1547:          TREE_TYPE (tta) = unknown_type_node;
        !          1548:          rhs = instantiate_type (lhstype, rhs, 0);
        !          1549:          inhibit_warnings = old_inhibit_warnings;
        !          1550: 
        !          1551:          if (TREE_CODE (rhs) == ERROR_MARK)
        !          1552:            harshness = 1;
        !          1553:          else
        !          1554:            {
        !          1555:              harshness = convert_harshness_old (lhstype, TREE_TYPE (rhs),
        !          1556:                                                 rhs);
        !          1557:              /* harshness |= 2; */
        !          1558:            }
        !          1559:        }
        !          1560:       else
        !          1561:        harshness = convert_harshness_old (TREE_VALUE (ttf),
        !          1562:                                           TREE_TYPE (TREE_VALUE (tta)),
        !          1563:                                           TREE_VALUE (tta));
        !          1564: 
        !          1565:       cp->v.old_harshness[strike_index] = harshness;
        !          1566:       if (EVIL_HARSHNESS (harshness)
        !          1567:          || CONTRAVARIANT_HARSHNESS (harshness))
        !          1568:        {
        !          1569:          cp->u.bad_arg = strike_index;
        !          1570:          evil_strikes = 1;
        !          1571:        }
        !          1572:      else if (ELLIPSIS_HARSHNESS (harshness))
        !          1573:        {
        !          1574:          ellipsis_strikes += 1;
        !          1575:        }
        !          1576: #if 0
        !          1577:       /* This is never set by `convert_harshness_old'.  */
        !          1578:       else if (USER_HARSHNESS (harshness))
        !          1579:        {
        !          1580:          user_strikes += 1;
        !          1581:        }
        !          1582: #endif
        !          1583:       else if (BASE_DERIVED_HARSHNESS (harshness))
        !          1584:        {
        !          1585:          b_or_d_strikes += INT_FROM_BD_HARSHNESS (harshness);
        !          1586:        }
        !          1587:       else
        !          1588:        easy_strikes += INT_FROM_EASY_HARSHNESS (harshness);
        !          1589:       ttf = TREE_CHAIN (ttf);
        !          1590:       tta = TREE_CHAIN (tta);
        !          1591:       strike_index += 1;
        !          1592:     }
        !          1593: 
        !          1594:   if (tta)
        !          1595:     {
        !          1596:       /* ran out of formals, and parmlist is fixed size.  */
        !          1597:       if (ttf /* == void_type_node */)
        !          1598:        {
        !          1599:          cp->evil = 1;
        !          1600:          cp->u.bad_arg = -1;
        !          1601:          return;
        !          1602:        }
        !          1603:       else ellipsis_strikes += list_length (tta);
        !          1604:     }
        !          1605:   else if (ttf && ttf != void_list_node)
        !          1606:     {
        !          1607:       /* ran out of actuals, and no defaults.  */
        !          1608:       if (TREE_PURPOSE (ttf) == NULL_TREE)
        !          1609:        {
        !          1610:          cp->evil = 1;
        !          1611:          cp->u.bad_arg = -2;
        !          1612:          return;
        !          1613:        }
        !          1614:       /* Store index of first default.  */
        !          1615:       cp->v.old_harshness[arglen] = strike_index+1;
        !          1616:     }
        !          1617:   else
        !          1618:     cp->v.old_harshness[arglen] = 0;
        !          1619: 
        !          1620:   /* Argument list lengths work out, so don't need to check them again.  */
        !          1621:   if (evil_strikes)
        !          1622:     {
        !          1623:       /* We do not check for derived->base conversions here, since in
        !          1624:         no case would they give evil strike counts, unless such conversions
        !          1625:         are somehow ambiguous.  */
        !          1626: 
        !          1627:       /* See if any user-defined conversions apply.
        !          1628:          But make sure that we do not loop.  */
        !          1629:       static int dont_convert_types = 0;
        !          1630: 
        !          1631:       if (dont_convert_types)
        !          1632:        {
        !          1633:          cp->evil = 1;
        !          1634:          return;
        !          1635:        }
        !          1636: 
        !          1637:       win = 0;                 /* Only get one chance to win.  */
        !          1638:       ttf = TYPE_ARG_TYPES (TREE_TYPE (function));
        !          1639:       tta = tta_in;
        !          1640:       strike_index = 0;
        !          1641:       evil_strikes = 0;
        !          1642: 
        !          1643:       while (ttf && tta)
        !          1644:        {
        !          1645:          if (ttf == void_list_node)
        !          1646:            break;
        !          1647: 
        !          1648:          lose = cp->v.old_harshness[strike_index];
        !          1649:          if (EVIL_HARSHNESS (lose)
        !          1650:              || CONTRAVARIANT_HARSHNESS (lose))
        !          1651:            {
        !          1652:              tree actual_type = TREE_TYPE (TREE_VALUE (tta));
        !          1653:              tree formal_type = TREE_VALUE (ttf);
        !          1654: 
        !          1655:              dont_convert_types = 1;
        !          1656: 
        !          1657:              if (TREE_CODE (formal_type) == REFERENCE_TYPE)
        !          1658:                formal_type = TREE_TYPE (formal_type);
        !          1659:              if (TREE_CODE (actual_type) == REFERENCE_TYPE)
        !          1660:                actual_type = TREE_TYPE (actual_type);
        !          1661: 
        !          1662:              if (formal_type != error_mark_node
        !          1663:                  && actual_type != error_mark_node)
        !          1664:                {
        !          1665:                  formal_type = TYPE_MAIN_VARIANT (formal_type);
        !          1666:                  actual_type = TYPE_MAIN_VARIANT (actual_type);
        !          1667: 
        !          1668:                  if (TYPE_HAS_CONSTRUCTOR (formal_type))
        !          1669:                    {
        !          1670:                      /* If it has a constructor for this type, try to use it.  */
        !          1671:                      if (convert_to_aggr (formal_type, TREE_VALUE (tta), 0, 1)
        !          1672:                          != error_mark_node)
        !          1673:                        {
        !          1674:                          /* @@ There is no way to save this result yet.
        !          1675:                             @@ So success is NULL_TREE for now.  */
        !          1676:                          win++;
        !          1677:                        }
        !          1678:                    }
        !          1679:                  if (TYPE_LANG_SPECIFIC (actual_type) && TYPE_HAS_CONVERSION (actual_type))
        !          1680:                    {
        !          1681:                      if (TREE_CODE (formal_type) == INTEGER_TYPE
        !          1682:                          && TYPE_HAS_INT_CONVERSION (actual_type))
        !          1683:                        win++;
        !          1684:                      else if (TREE_CODE (formal_type) == REAL_TYPE
        !          1685:                               && TYPE_HAS_REAL_CONVERSION (actual_type))
        !          1686:                        win++;
        !          1687:                      else
        !          1688:                        {
        !          1689:                          tree conv = build_type_conversion (CALL_EXPR, TREE_VALUE (ttf), TREE_VALUE (tta), 0);
        !          1690:                          if (conv)
        !          1691:                            {
        !          1692:                              if (conv == error_mark_node)
        !          1693:                                win += 2;
        !          1694:                              else
        !          1695:                                win++;
        !          1696:                            }
        !          1697:                          else if (TREE_CODE (TREE_VALUE (ttf)) == REFERENCE_TYPE)
        !          1698:                            {
        !          1699:                              conv = build_type_conversion (CALL_EXPR, formal_type, TREE_VALUE (tta), 0);
        !          1700:                              if (conv)
        !          1701:                                {
        !          1702:                                  if (conv == error_mark_node)
        !          1703:                                    win += 2;
        !          1704:                                  else
        !          1705:                                    win++;
        !          1706:                                }
        !          1707:                            }
        !          1708:                        }
        !          1709:                    }
        !          1710:                }
        !          1711:              dont_convert_types = 0;
        !          1712: 
        !          1713:              if (win == 1)
        !          1714:                {
        !          1715:                  user_strikes += 1;
        !          1716:                  cp->v.old_harshness[strike_index] = USER_HARSHNESS (-1);
        !          1717:                  win = 0;
        !          1718:                }
        !          1719:              else
        !          1720:                {
        !          1721:                  if (cp->u.bad_arg > strike_index)
        !          1722:                    cp->u.bad_arg = strike_index;
        !          1723: 
        !          1724:                  evil_strikes = win ? 2 : 1;
        !          1725:                  break;
        !          1726:                }
        !          1727:            }
        !          1728: 
        !          1729:          ttf = TREE_CHAIN (ttf);
        !          1730:          tta = TREE_CHAIN (tta);
        !          1731:          strike_index += 1;
        !          1732:        }
        !          1733:     }
        !          1734: 
        !          1735:   /* Const member functions get a small penalty because defaulting
        !          1736:      to const is less useful than defaulting to non-const. */
        !          1737:   /* This is bogus, it does not correspond to anything in the ARM.
        !          1738:      This code will be fixed when this entire section is rewritten
        !          1739:      to conform to the ARM.  (mrs)  */
        !          1740:   if (TREE_CODE (TREE_TYPE (function)) == METHOD_TYPE)
        !          1741:     {
        !          1742:       if (TYPE_READONLY (TREE_TYPE (TREE_VALUE (ttf_in))))
        !          1743:        {
        !          1744:          cp->v.old_harshness[0] += INT_TO_EASY_HARSHNESS (1);
        !          1745:          ++easy_strikes;
        !          1746:        }
        !          1747:       else
        !          1748:        {
        !          1749:          /* Calling a non-const member function from a const member function
        !          1750:             is probably invalid, but for now we let it only draw a warning.
        !          1751:             We indicate that such a mismatch has occurred by setting the
        !          1752:             harshness to a maximum value.  */
        !          1753:          if (TREE_CODE (TREE_TYPE (TREE_VALUE (tta_in))) == POINTER_TYPE
        !          1754:              && (TYPE_READONLY (TREE_TYPE (TREE_TYPE (TREE_VALUE (tta_in))))))
        !          1755:            cp->v.old_harshness[0] |= CONST_HARSHNESS (-1);
        !          1756:        }
        !          1757:     }
        !          1758: 
        !          1759:   cp->evil = evil_strikes;
        !          1760:   cp->ellipsis = ellipsis_strikes;
        !          1761:   cp->user = user_strikes;
        !          1762:   cp->b_or_d = b_or_d_strikes;
        !          1763:   cp->easy = easy_strikes;
        !          1764: }
        !          1765: 
        !          1766: void
        !          1767: compute_conversion_costs (function, tta_in, cp, arglen)
        !          1768:      tree function;
        !          1769:      tree tta_in;
        !          1770:      struct candidate *cp;
        !          1771:      int arglen;
        !          1772: {
        !          1773:   if (flag_ansi_overloading)
        !          1774:     compute_conversion_costs_ansi (function, tta_in, cp, arglen);
        !          1775:   else
        !          1776:     compute_conversion_costs_old (function, tta_in, cp, arglen);
        !          1777: }
        !          1778: 
        !          1779: /* When one of several possible overloaded functions and/or methods
        !          1780:    can be called, choose the best candidate for overloading.
        !          1781: 
        !          1782:    BASETYPE is the context from which we start method resolution
        !          1783:    or NULL if we are comparing overloaded functions.
        !          1784:    CANDIDATES is the array of candidates we have to choose from.
        !          1785:    N_CANDIDATES is the length of CANDIDATES.
        !          1786:    PARMS is a TREE_LIST of parameters to the function we'll ultimately
        !          1787:    choose.  It is modified in place when resolving methods.  It is not
        !          1788:    modified in place when resolving overloaded functions.
        !          1789:    LEN is the length of the parameter list.  */
        !          1790: 
        !          1791: static struct candidate *
        !          1792: ideal_candidate_old (basetype, candidates, n_candidates, parms, len)
        !          1793:      tree basetype;
        !          1794:      struct candidate *candidates;
        !          1795:      int n_candidates;
        !          1796:      tree parms;
        !          1797:      int len;
        !          1798: {
        !          1799:   struct candidate *cp = candidates + n_candidates;
        !          1800:   int index, i;
        !          1801:   tree ttf;
        !          1802: 
        !          1803:   qsort (candidates,           /* char *base */
        !          1804:         n_candidates,          /* int nel */
        !          1805:         sizeof (struct candidate), /* int width */
        !          1806:         rank_for_overload);    /* int (*compar)() */
        !          1807: 
        !          1808:   /* If the best candidate requires user-defined conversions,
        !          1809:      and its user-defined conversions are a strict subset
        !          1810:      of all other candidates requiring user-defined conversions,
        !          1811:      then it is, in fact, the best.  */
        !          1812:   for (i = -1; cp + i != candidates; i--)
        !          1813:     if (cp[i].user == 0)
        !          1814:       break;
        !          1815: 
        !          1816:   if (i < -1)
        !          1817:     {
        !          1818:       tree ttf0;
        !          1819: 
        !          1820:       /* Check that every other candidate requires those conversions
        !          1821:         as a strict subset of their conversions.  */
        !          1822:       if (cp[i].user == cp[-1].user)
        !          1823:        goto non_subset;
        !          1824: 
        !          1825:       /* Look at subset relationship more closely.  */
        !          1826:       while (i != -1)
        !          1827:        {
        !          1828:          for (ttf = TYPE_ARG_TYPES (TREE_TYPE (cp[i].function)),
        !          1829:               ttf0 = TYPE_ARG_TYPES (TREE_TYPE (cp[-1].function)),
        !          1830:               index = 0; index < len; index++)
        !          1831:            {
        !          1832:              if (USER_HARSHNESS (cp[i].v.old_harshness[index]))
        !          1833:                {
        !          1834:                  /* If our "best" candidate also needs a conversion,
        !          1835:                     it must be the same one.  */
        !          1836:                  if (USER_HARSHNESS (cp[-1].v.old_harshness[index])
        !          1837:                      && TREE_VALUE (ttf) != TREE_VALUE (ttf0))
        !          1838:                    goto non_subset;
        !          1839:                }
        !          1840:              ttf = TREE_CHAIN (ttf);
        !          1841:              ttf0 = TREE_CHAIN (ttf0);
        !          1842:              /* Handle `...' gracefully.  */
        !          1843:              if (ttf == NULL_TREE || ttf0 == NULL_TREE)
        !          1844:                break;
        !          1845:            }
        !          1846:          i++;
        !          1847:        }
        !          1848:       /* The best was the best.  */
        !          1849:       return cp - 1;
        !          1850:     non_subset:
        !          1851:       /* Use other rules for determining "bestness".  */
        !          1852:       ;
        !          1853:     }
        !          1854: 
        !          1855:   /* If the best two candidates we find require user-defined
        !          1856:      conversions, we may need to report and error message.  */
        !          1857:   if (cp[-1].user && cp[-2].user
        !          1858:       && (cp[-1].b_or_d || cp[-2].b_or_d == 0))
        !          1859:     {
        !          1860:       /* If the best two methods found involved user-defined
        !          1861:         type conversions, then we must see whether one
        !          1862:         of them is exactly what we wanted.  If not, then
        !          1863:         we have an ambiguity.  */
        !          1864:       int best = 0;
        !          1865:       tree tta = parms;
        !          1866:       tree f1;
        !          1867: #if 0
        !          1868:       /* for LUCID */
        !          1869:       tree p1;
        !          1870: #endif
        !          1871: 
        !          1872:       /* Stash all of our parameters in safe places
        !          1873:         so that we can perform type conversions in place.  */
        !          1874:       while (tta)
        !          1875:        {
        !          1876:          TREE_PURPOSE (tta) = TREE_VALUE (tta);
        !          1877:          tta = TREE_CHAIN (tta);
        !          1878:        }
        !          1879: 
        !          1880:       i = 0;
        !          1881:       do
        !          1882:        {
        !          1883:          int exact_conversions = 0;
        !          1884: 
        !          1885:          i -= 1;
        !          1886:          tta = parms;
        !          1887:          if (DECL_STATIC_FUNCTION_P (cp[i].function))
        !          1888:            tta = TREE_CHAIN (tta);
        !          1889:          /* special note, we don't go through len parameters, because we
        !          1890:             may only need len-1 parameters because of a call to a static
        !          1891:             member. */
        !          1892:          for (ttf = TYPE_ARG_TYPES (TREE_TYPE (cp[i].function)), index = 0;
        !          1893:               tta;
        !          1894:               tta = TREE_CHAIN (tta), ttf = TREE_CHAIN (ttf), index++)
        !          1895:            {
        !          1896:              /* If this is a varargs function, there's no conversion to do,
        !          1897:                 but don't accept an arg that needs a copy ctor.  */
        !          1898:              if (ttf == NULL_TREE)
        !          1899:                {
        !          1900:                  /* FIXME: verify that we cannot get here with an
        !          1901:                     arg that needs a ctor.  */
        !          1902:                  break;
        !          1903:                }
        !          1904: 
        !          1905:              if (USER_HARSHNESS (cp[i].v.old_harshness[index]))
        !          1906:                {
        !          1907:                  tree this_parm = build_type_conversion (CALL_EXPR, TREE_VALUE (ttf), TREE_PURPOSE (tta), 2);
        !          1908:                  if (basetype != NULL_TREE)
        !          1909:                    TREE_VALUE (tta) = this_parm;
        !          1910:                  if (this_parm)
        !          1911:                    {
        !          1912:                      if (TREE_CODE (this_parm) != CONVERT_EXPR
        !          1913:                          && (TREE_CODE (this_parm) != NOP_EXPR
        !          1914:                              || comp_target_types (TREE_TYPE (this_parm),
        !          1915:                                                    TREE_TYPE (TREE_OPERAND (this_parm, 0)), 1)))
        !          1916:                        exact_conversions += 1;
        !          1917:                    }
        !          1918:                  else if (PROMOTES_TO_AGGR_TYPE (TREE_VALUE (ttf), REFERENCE_TYPE))
        !          1919:                    {
        !          1920:                      /* To get here we had to have succeeded via
        !          1921:                         a constructor.  */
        !          1922:                      TREE_VALUE (tta) = TREE_PURPOSE (tta);
        !          1923:                      exact_conversions += 1;
        !          1924:                    }
        !          1925:                }
        !          1926:            }
        !          1927:          if (exact_conversions == cp[i].user)
        !          1928:            {
        !          1929:              if (best == 0)
        !          1930:                {
        !          1931:                  best = i;
        !          1932:                  f1 = cp[best].function;
        !          1933: #if 0
        !          1934:                  /* For LUCID */
        !          1935:                  p1 = TYPE_ARG_TYPES (TREE_TYPE (f1));
        !          1936: #endif
        !          1937:                }
        !          1938:              else
        !          1939:                {
        !          1940:                  /* Don't complain if next best is from base class.  */
        !          1941:                  tree f2 = cp[i].function;
        !          1942: 
        !          1943:                  if (TREE_CODE (TREE_TYPE (f1)) == METHOD_TYPE
        !          1944:                      && TREE_CODE (TREE_TYPE (f2)) == METHOD_TYPE
        !          1945:                      && BASE_DERIVED_HARSHNESS (cp[i].v.old_harshness[0])
        !          1946:                      && cp[best].v.old_harshness[0] < cp[i].v.old_harshness[0])
        !          1947:                    {
        !          1948: #if 0
        !          1949:                      tree p2 = TYPE_ARG_TYPES (TREE_TYPE (f2));
        !          1950:                      /* For LUCID.  */
        !          1951:                      if (! compparms (TREE_CHAIN (p1), TREE_CHAIN (p2), 1))
        !          1952:                        goto ret0;
        !          1953:                      else
        !          1954: #endif
        !          1955:                        continue;
        !          1956:                    }
        !          1957:                  else
        !          1958:                    {
        !          1959:                      /* Ensure that there's nothing ambiguous about these
        !          1960:                         two fns.  */
        !          1961:                      int identical = 1;
        !          1962:                      for (index = 0; index < len; index++)
        !          1963:                        {
        !          1964:                          /* Type conversions must be piecewise equivalent.  */
        !          1965:                          if (USER_HARSHNESS (cp[best].v.old_harshness[index])
        !          1966:                              != USER_HARSHNESS (cp[i].v.old_harshness[index]))
        !          1967:                            goto ret0;
        !          1968:                          /* If there's anything we like better about the
        !          1969:                             other function, consider it ambiguous.  */
        !          1970:                          if (cp[i].v.old_harshness[index] < cp[best].v.old_harshness[index])
        !          1971:                            goto ret0;
        !          1972:                          /* If any single one it diffent, then the whole is
        !          1973:                             not identical.  */
        !          1974:                          if (cp[i].v.old_harshness[index] != cp[best].v.old_harshness[index])
        !          1975:                            identical = 0;
        !          1976:                        }
        !          1977: 
        !          1978:                      /* If we can't tell the difference between the two, it
        !          1979:                         is ambiguous.  */
        !          1980:                      if (identical)
        !          1981:                        goto ret0;
        !          1982: 
        !          1983:                      /* If we made it to here, it means we're satisfied that
        !          1984:                         BEST is still best.  */
        !          1985:                      continue;
        !          1986:                    }
        !          1987:                }
        !          1988:            }
        !          1989:        } while (cp + i != candidates);
        !          1990: 
        !          1991:       if (best)
        !          1992:        {
        !          1993:          int exact_conversions = cp[best].user;
        !          1994:          tta = parms;
        !          1995:          if (DECL_STATIC_FUNCTION_P (cp[best].function))
        !          1996:            tta = TREE_CHAIN (parms);
        !          1997:          for (ttf = TYPE_ARG_TYPES (TREE_TYPE (cp[best].function)), index = 0;
        !          1998:               exact_conversions > 0;
        !          1999:               tta = TREE_CHAIN (tta), ttf = TREE_CHAIN (ttf), index++)
        !          2000:            {
        !          2001:              if (USER_HARSHNESS (cp[best].v.old_harshness[index]))
        !          2002:                {
        !          2003:                  /* We must now fill in the slot we left behind.
        !          2004:                     @@ This could be optimized to use the value previously
        !          2005:                     @@ computed by build_type_conversion in some cases.  */
        !          2006:                  if (basetype != NULL_TREE)
        !          2007:                    TREE_VALUE (tta) = convert (TREE_VALUE (ttf), TREE_PURPOSE (tta));
        !          2008:                  exact_conversions -= 1;
        !          2009:                }
        !          2010:              else
        !          2011:                TREE_VALUE (tta) = TREE_PURPOSE (tta);
        !          2012:            }
        !          2013:          return cp + best;
        !          2014:        }
        !          2015:       goto ret0;
        !          2016:     }
        !          2017:   /* If the best two candidates we find both use default parameters,
        !          2018:      we may need to report and error.  Don't need to worry if next-best
        !          2019:      candidate is forced to use user-defined conversion when best is not.  */
        !          2020:   if (cp[-2].user == 0
        !          2021:       && cp[-1].v.old_harshness[len] != 0 && cp[-2].v.old_harshness[len] != 0)
        !          2022:     {
        !          2023:       tree tt1 = TYPE_ARG_TYPES (TREE_TYPE (cp[-1].function));
        !          2024:       tree tt2 = TYPE_ARG_TYPES (TREE_TYPE (cp[-2].function));
        !          2025:       unsigned i = cp[-1].v.old_harshness[len];
        !          2026: 
        !          2027:       if (cp[-2].v.old_harshness[len] < i)
        !          2028:        i = cp[-2].v.old_harshness[len];
        !          2029:       while (--i > 0)
        !          2030:        {
        !          2031:          if (TYPE_MAIN_VARIANT (TREE_VALUE (tt1))
        !          2032:              != TYPE_MAIN_VARIANT (TREE_VALUE (tt2)))
        !          2033:            /* These lists are not identical, so we can choose our best candidate.  */
        !          2034:            return cp - 1;
        !          2035:          tt1 = TREE_CHAIN (tt1);
        !          2036:          tt2 = TREE_CHAIN (tt2);
        !          2037:        }
        !          2038:       /* To get here, both lists had the same parameters up to the defaults
        !          2039:         which were used.  This is an ambiguous request.  */
        !          2040:       goto ret0;
        !          2041:     }
        !          2042: 
        !          2043:   /* Otherwise, return our best candidate.  Note that if we get candidates
        !          2044:      from independent base classes, we have an ambiguity, even if one
        !          2045:      argument list look a little better than another one.  */
        !          2046:   if (cp[-1].b_or_d && basetype && TYPE_USES_MULTIPLE_INHERITANCE (basetype))
        !          2047:     {
        !          2048:       int i = n_candidates - 1, best = i;
        !          2049:       tree base1 = NULL_TREE;
        !          2050: 
        !          2051:       if (TREE_CODE (TREE_TYPE (candidates[i].function)) == FUNCTION_TYPE)
        !          2052:        return cp - 1;
        !          2053: 
        !          2054:       for (; i >= 0 && candidates[i].user == 0 && candidates[i].evil == 0; i--)
        !          2055:        {
        !          2056:          if (TREE_CODE (TREE_TYPE (candidates[i].function)) == METHOD_TYPE)
        !          2057:            {
        !          2058:              tree newbase = DECL_CLASS_CONTEXT (candidates[i].function);
        !          2059: 
        !          2060:              if (base1 != NULL_TREE)
        !          2061:                {
        !          2062:                  /* newbase could be a base or a parent of base1 */
        !          2063:                  if (newbase != base1 && ! UNIQUELY_DERIVED_FROM_P (newbase, base1)
        !          2064:                      && ! UNIQUELY_DERIVED_FROM_P (base1, newbase))
        !          2065:                    {
        !          2066:                      cp_error ("ambiguous request for function from distinct base classes of type `%T'", basetype);
        !          2067:                      cp_error_at ("  first candidate is `%#D'",
        !          2068:                                     candidates[best].function);
        !          2069:                      cp_error_at ("  second candidate is `%#D'",
        !          2070:                                     candidates[i].function);
        !          2071:                      cp[-1].evil = 1;
        !          2072:                      return cp - 1;
        !          2073:                    }
        !          2074:                }
        !          2075:              else
        !          2076:                {
        !          2077:                  best = i;
        !          2078:                  base1 = newbase;
        !          2079:                }
        !          2080:            }
        !          2081:          else
        !          2082:            return cp - 1;
        !          2083:        }
        !          2084:     }
        !          2085: 
        !          2086:   /* Don't accept a candidate as being ideal if it's indistinguishable
        !          2087:      from another candidate.  */
        !          2088:   if (rank_for_overload (cp-1, cp-2) == 0)
        !          2089:     {
        !          2090:       /* If the types are distinguishably different (like
        !          2091:         `long' vs. `unsigned long'), that's ok.  But if they are arbitrarily
        !          2092:         different, such as `int (*)(void)' vs. `void (*)(int)',
        !          2093:         that's not ok.  */
        !          2094:       tree p1 = TYPE_ARG_TYPES (TREE_TYPE (cp[-1].function));
        !          2095:       tree p2 = TYPE_ARG_TYPES (TREE_TYPE (cp[-2].function));
        !          2096:       while (p1 && p2)
        !          2097:        {
        !          2098:          if (TREE_CODE (TREE_VALUE (p1)) == POINTER_TYPE
        !          2099:              && TREE_CODE (TREE_TYPE (TREE_VALUE (p1))) == FUNCTION_TYPE
        !          2100:              && TREE_VALUE (p1) != TREE_VALUE (p2))
        !          2101:            return NULL;
        !          2102:          p1 = TREE_CHAIN (p1);
        !          2103:          p2 = TREE_CHAIN (p2);
        !          2104:        }
        !          2105:       if (p1 || p2)
        !          2106:        return NULL;
        !          2107:     }
        !          2108: 
        !          2109:   return cp - 1;
        !          2110: 
        !          2111:  ret0:
        !          2112:   /* In the case where there is no ideal candidate, restore
        !          2113:      TREE_VALUE slots of PARMS from TREE_PURPOSE slots.  */
        !          2114:   while (parms)
        !          2115:     {
        !          2116:       TREE_VALUE (parms) = TREE_PURPOSE (parms);
        !          2117:       parms = TREE_CHAIN (parms);
        !          2118:     }
        !          2119:   return NULL;
        !          2120: }
        !          2121: 
        !          2122: /* Subroutine of ideal_candidate.  See if X or Y is a better match
        !          2123:    than the other.  */
        !          2124: static int
        !          2125: strictly_better (x, y)
        !          2126:      unsigned short x, y;
        !          2127: {
        !          2128:   unsigned short xor;
        !          2129: 
        !          2130:   if (x == y)
        !          2131:     return 0;
        !          2132: 
        !          2133:   xor = x ^ y;
        !          2134:   if (xor >= x || xor >= y)
        !          2135:     return 1;
        !          2136:   return 0;
        !          2137: }
        !          2138: 
        !          2139: static struct candidate *
        !          2140: ideal_candidate_ansi (basetype, candidates, n_candidates, parms, len)
        !          2141:      tree basetype;
        !          2142:      struct candidate *candidates;
        !          2143:      int n_candidates;
        !          2144:      tree parms;
        !          2145:      int len;
        !          2146: {
        !          2147:   struct candidate *cp = candidates+n_candidates;
        !          2148:   int i, j, best_code;
        !          2149: 
        !          2150:   /* For each argument, sort the functions from best to worst for the arg.
        !          2151:      For each function that's not best for this arg, set its overall
        !          2152:      harshness to EVIL so that other args won't like it.  The candidate
        !          2153:      list for the last argument is the intersection of all the best-liked
        !          2154:      functions.  */
        !          2155: 
        !          2156:   for (i = 0; i < len; i++)
        !          2157:     {
        !          2158:       qsort (candidates, n_candidates, sizeof (struct candidate),
        !          2159:             rank_for_overload);
        !          2160:       best_code = cp[-1].h.code;
        !          2161: 
        !          2162:       /* To find out functions that are worse than that represented
        !          2163:         by BEST_CODE, we can't just do a comparison like h.code>best_code.
        !          2164:         The total harshness for the "best" fn may be 8|8 for two args, and
        !          2165:         the harshness for the next-best may be 8|2.  If we just compared,
        !          2166:         that would be checking 8>10, which would lead to the next-best
        !          2167:         being disqualified.  What we actually want to do is get rid
        !          2168:         of functions that are definitely worse than that represented
        !          2169:         by best_code, i.e. those which have bits set higher than the
        !          2170:         highest in best_code.  Sooooo, what we do is clear out everything
        !          2171:         represented by best_code, and see if we still come up with something
        !          2172:         higher.  If so (e.g., 8|8 vs 8|16), it'll disqualify it properly.  */
        !          2173:       for (j = n_candidates-2; j >= 0; j--)
        !          2174:        if ((candidates[j].h.code & ~best_code) > best_code)
        !          2175:          candidates[j].h.code = EVIL_CODE;
        !          2176:     }
        !          2177: 
        !          2178:   if (cp[-1].h.code & EVIL_CODE)
        !          2179:     return NULL;
        !          2180: 
        !          2181:   /* If they're at least as good as each other, do an arg-by-arg check.  */
        !          2182:   if (! strictly_better (cp[-1].h.code, cp[-2].h.code))
        !          2183:     {
        !          2184:       int better = 0;
        !          2185:       int worse = 0;
        !          2186: 
        !          2187:       for (j = 0; j < n_candidates; j++)
        !          2188:        if (! strictly_better (candidates[j].h.code, best_code))
        !          2189:          break;
        !          2190: 
        !          2191:       qsort (candidates+j, n_candidates-j, sizeof (struct candidate),
        !          2192:             rank_for_ideal);
        !          2193:       for (i = 0; i < len; i++)
        !          2194:        {
        !          2195:          if (cp[-1].v.ansi_harshness[i].code < cp[-2].v.ansi_harshness[i].code)
        !          2196:            better = 1;
        !          2197:          else if (cp[-1].v.ansi_harshness[i].code > cp[-2].v.ansi_harshness[i].code)
        !          2198:            worse = 1;
        !          2199:          else if (cp[-1].v.ansi_harshness[i].code & STD_CODE)
        !          2200:            {
        !          2201:              /* If it involves a standard conversion, let the
        !          2202:                 inheritance lattice be the final arbiter.  */
        !          2203:              if (cp[-1].v.ansi_harshness[i].distance > cp[-2].v.ansi_harshness[i].distance)
        !          2204:                worse = 1;
        !          2205:              else if (cp[-1].v.ansi_harshness[i].distance < cp[-2].v.ansi_harshness[i].distance)
        !          2206:                better = 1;
        !          2207:            }
        !          2208:          else if (cp[-1].v.ansi_harshness[i].code & PROMO_CODE)
        !          2209:            {
        !          2210:              /* For integral promotions, take into account a finer granularity for
        !          2211:                 determining which types should be favored over others in such
        !          2212:                 promotions.  */
        !          2213:              if (cp[-1].v.ansi_harshness[i].int_penalty > cp[-2].v.ansi_harshness[i].int_penalty)
        !          2214:                worse = 1;
        !          2215:              else if (cp[-1].v.ansi_harshness[i].int_penalty < cp[-2].v.ansi_harshness[i].int_penalty)
        !          2216:                better = 1;
        !          2217:            }
        !          2218:        }
        !          2219: 
        !          2220:       if (! better || worse)
        !          2221:        return NULL;
        !          2222:     }
        !          2223:   return cp-1;
        !          2224: }
        !          2225: 
        !          2226: static struct candidate *
        !          2227: ideal_candidate (basetype, candidates, n_candidates, parms, len)
        !          2228:      tree basetype;
        !          2229:      struct candidate *candidates;
        !          2230:      int n_candidates;
        !          2231:      tree parms;
        !          2232:      int len;
        !          2233: {
        !          2234:   if (flag_ansi_overloading)
        !          2235:     return ideal_candidate_ansi (basetype, candidates, n_candidates, parms,
        !          2236:                                 len);
        !          2237:   else
        !          2238:     return ideal_candidate_old (basetype, candidates, n_candidates, parms,
        !          2239:                                len);
        !          2240: }
        !          2241: 
        !          2242: /* Assume that if the class referred to is not in the
        !          2243:    current class hierarchy, that it may be remote.
        !          2244:    PARENT is assumed to be of aggregate type here.  */
        !          2245: static int
        !          2246: may_be_remote (parent)
        !          2247:      tree parent;
        !          2248: {
        !          2249:   if (TYPE_OVERLOADS_METHOD_CALL_EXPR (parent) == 0)
        !          2250:     return 0;
        !          2251: 
        !          2252:   if (current_class_type == NULL_TREE)
        !          2253:     return 0;
        !          2254: 
        !          2255:   if (parent == current_class_type)
        !          2256:     return 0;
        !          2257: 
        !          2258:   if (UNIQUELY_DERIVED_FROM_P (parent, current_class_type))
        !          2259:     return 0;
        !          2260:   return 1;
        !          2261: }
        !          2262: 
        !          2263: tree
        !          2264: build_vfield_ref (datum, type)
        !          2265:      tree datum, type;
        !          2266: {
        !          2267:   tree rval;
        !          2268:   int old_assume_nonnull_objects = flag_assume_nonnull_objects;
        !          2269: 
        !          2270:   if (datum == error_mark_node)
        !          2271:     return error_mark_node;
        !          2272: 
        !          2273:   /* Vtable references are always made from non-null objects.  */
        !          2274:   flag_assume_nonnull_objects = 1;
        !          2275:   if (TREE_CODE (TREE_TYPE (datum)) == REFERENCE_TYPE)
        !          2276:     datum = convert_from_reference (datum);
        !          2277: 
        !          2278:   if (! TYPE_USES_COMPLEX_INHERITANCE (type))
        !          2279:     rval = build (COMPONENT_REF, TREE_TYPE (CLASSTYPE_VFIELD (type)),
        !          2280:                  datum, CLASSTYPE_VFIELD (type));
        !          2281:   else
        !          2282:     rval = build_component_ref (datum, DECL_NAME (CLASSTYPE_VFIELD (type)), 0, 0);
        !          2283:   flag_assume_nonnull_objects = old_assume_nonnull_objects;
        !          2284: 
        !          2285:   return rval;
        !          2286: }
        !          2287: 
        !          2288: /* Build a call to a member of an object.  I.e., one that overloads
        !          2289:    operator ()(), or is a pointer-to-function or pointer-to-method.  */
        !          2290: static tree
        !          2291: build_field_call (basetype_path, instance_ptr, name, parms, err_name)
        !          2292:      tree basetype_path, instance_ptr, name, parms;
        !          2293:      char *err_name;
        !          2294: {
        !          2295:   tree field, instance;
        !          2296: 
        !          2297:   if (instance_ptr == current_class_decl)
        !          2298:     {
        !          2299:       /* Check to see if we really have a reference to an instance variable
        !          2300:         with `operator()()' overloaded.  */
        !          2301:       field = IDENTIFIER_CLASS_VALUE (name);
        !          2302: 
        !          2303:       if (field == NULL_TREE)
        !          2304:        {
        !          2305:          error ("`this' has no member named `%s'", err_name);
        !          2306:          return error_mark_node;
        !          2307:        }
        !          2308: 
        !          2309:       if (TREE_CODE (field) == FIELD_DECL)
        !          2310:        {
        !          2311:          /* If it's a field, try overloading operator (),
        !          2312:             or calling if the field is a pointer-to-function.  */
        !          2313:          instance = build_component_ref_1 (C_C_D, field, 0);
        !          2314:          if (instance == error_mark_node)
        !          2315:            return error_mark_node;
        !          2316: 
        !          2317:          if (TYPE_LANG_SPECIFIC (TREE_TYPE (instance))
        !          2318:              && TYPE_OVERLOADS_CALL_EXPR (TREE_TYPE (instance)))
        !          2319:            return build_opfncall (CALL_EXPR, LOOKUP_NORMAL, instance, parms, NULL_TREE);
        !          2320: 
        !          2321:          if (TREE_CODE (TREE_TYPE (instance)) == POINTER_TYPE)
        !          2322:            {
        !          2323:              if (TREE_CODE (TREE_TYPE (TREE_TYPE (instance))) == FUNCTION_TYPE)
        !          2324:                return build_function_call (instance, parms);
        !          2325:              else if (TREE_CODE (TREE_TYPE (TREE_TYPE (instance))) == METHOD_TYPE)
        !          2326:                return build_function_call (instance, tree_cons (NULL_TREE, current_class_decl, parms));
        !          2327:            }
        !          2328:        }
        !          2329:       return NULL_TREE;
        !          2330:     }
        !          2331: 
        !          2332:   /* Check to see if this is not really a reference to an instance variable
        !          2333:      with `operator()()' overloaded.  */
        !          2334:   field = lookup_field (basetype_path, name, 1, 0);
        !          2335: 
        !          2336:   /* This can happen if the reference was ambiguous
        !          2337:      or for visibility violations.  */
        !          2338:   if (field == error_mark_node)
        !          2339:     return error_mark_node;
        !          2340: 
        !          2341:   if (field)
        !          2342:     {
        !          2343:       tree basetype;
        !          2344:       tree ftype = TREE_TYPE (field);
        !          2345: 
        !          2346:       if (TREE_CODE (ftype) == REFERENCE_TYPE)
        !          2347:        ftype = TREE_TYPE (ftype);
        !          2348: 
        !          2349:       if (TYPE_LANG_SPECIFIC (ftype) && TYPE_OVERLOADS_CALL_EXPR (ftype))
        !          2350:        {
        !          2351:          /* Make the next search for this field very short.  */
        !          2352:          basetype = DECL_FIELD_CONTEXT (field);
        !          2353:          instance_ptr = convert_pointer_to (basetype, instance_ptr);
        !          2354: 
        !          2355:          instance = build_indirect_ref (instance_ptr, NULL_PTR);
        !          2356:          return build_opfncall (CALL_EXPR, LOOKUP_NORMAL,
        !          2357:                                 build_component_ref_1 (instance, field, 0),
        !          2358:                                 parms, NULL_TREE);
        !          2359:        }
        !          2360:       if (TREE_CODE (ftype) == POINTER_TYPE)
        !          2361:        {
        !          2362:          if (TREE_CODE (TREE_TYPE (ftype)) == FUNCTION_TYPE
        !          2363:              || TREE_CODE (TREE_TYPE (ftype)) == METHOD_TYPE)
        !          2364:            {
        !          2365:              /* This is a member which is a pointer to function.  */
        !          2366:              tree ref
        !          2367:                = build_component_ref_1 (build_indirect_ref (instance_ptr,
        !          2368:                                                             NULL_PTR),
        !          2369:                                         field, LOOKUP_COMPLAIN);
        !          2370:              if (ref == error_mark_node)
        !          2371:                return error_mark_node;
        !          2372:              return build_function_call (ref, parms);
        !          2373:            }
        !          2374:        }
        !          2375:       else if (TREE_CODE (ftype) == METHOD_TYPE)
        !          2376:        {
        !          2377:          error ("invalid call via pointer-to-member function");
        !          2378:          return error_mark_node;
        !          2379:        }
        !          2380:       else
        !          2381:        return NULL_TREE;
        !          2382:     }
        !          2383:   return NULL_TREE;
        !          2384: }
        !          2385: 
        !          2386: tree
        !          2387: find_scoped_type (type, inner_name, inner_types)
        !          2388:      tree type, inner_name, inner_types;
        !          2389: {
        !          2390:   tree tags = CLASSTYPE_TAGS (type);
        !          2391: 
        !          2392:   while (tags)
        !          2393:     {
        !          2394:       /* The TREE_PURPOSE of an enum tag (which becomes a member of the
        !          2395:         enclosing class) is set to the name for the enum type.  So, if
        !          2396:         inner_name is `bar', and we strike `baz' for `enum bar { baz }',
        !          2397:         then this test will be true.  */
        !          2398:       if (TREE_PURPOSE (tags) == inner_name)
        !          2399:        {
        !          2400:          if (inner_types == NULL_TREE)
        !          2401:            return DECL_NESTED_TYPENAME (TYPE_NAME (TREE_VALUE (tags)));
        !          2402:          return resolve_scope_to_name (TREE_VALUE (tags), inner_types);
        !          2403:        }
        !          2404:       tags = TREE_CHAIN (tags);
        !          2405:     }
        !          2406: 
        !          2407: #if 0
        !          2408:   /* XXX This needs to be fixed better.  */
        !          2409:   if (TREE_CODE (type) == UNINSTANTIATED_P_TYPE)
        !          2410:     {
        !          2411:       sorry ("nested class lookup in template type");
        !          2412:       return NULL_TREE;
        !          2413:     }
        !          2414: #endif
        !          2415: 
        !          2416:   /* Look for a TYPE_DECL.  */
        !          2417:   for (tags = TYPE_FIELDS (type); tags; tags = TREE_CHAIN (tags))
        !          2418:     if (TREE_CODE (tags) == TYPE_DECL && DECL_NAME (tags) == inner_name)
        !          2419:       {
        !          2420:        /* Code by raeburn.  */
        !          2421:        if (inner_types == NULL_TREE)
        !          2422:          return DECL_NESTED_TYPENAME (tags);
        !          2423:        return resolve_scope_to_name (TREE_TYPE (tags), inner_types);
        !          2424:       }
        !          2425: 
        !          2426:   return NULL_TREE;
        !          2427: }
        !          2428: 
        !          2429: /* Resolve an expression NAME1::NAME2::...::NAMEn to
        !          2430:    the name that names the above nested type.  INNER_TYPES
        !          2431:    is a chain of nested type names (held together by SCOPE_REFs);
        !          2432:    OUTER_TYPE is the type we know to enclose INNER_TYPES.
        !          2433:    Returns NULL_TREE if there is an error.  */
        !          2434: tree
        !          2435: resolve_scope_to_name (outer_type, inner_types)
        !          2436:      tree outer_type, inner_types;
        !          2437: {
        !          2438:   register tree tmp;
        !          2439:   tree inner_name;
        !          2440: 
        !          2441:   if (outer_type == NULL_TREE && current_class_type != NULL_TREE)
        !          2442:     {
        !          2443:       /* We first try to look for a nesting in our current class context,
        !          2444:          then try any enclosing classes.  */
        !          2445:       tree type = current_class_type;
        !          2446:       
        !          2447:       while (type && (TREE_CODE (type) == RECORD_TYPE
        !          2448:                      || TREE_CODE (type) == UNION_TYPE))
        !          2449:         {
        !          2450:           tree rval = resolve_scope_to_name (type, inner_types);
        !          2451: 
        !          2452:          if (rval != NULL_TREE)
        !          2453:            return rval;
        !          2454:          type = DECL_CONTEXT (TYPE_NAME (type));
        !          2455:        }
        !          2456:     }
        !          2457: 
        !          2458:   if (TREE_CODE (inner_types) == SCOPE_REF)
        !          2459:     {
        !          2460:       inner_name = TREE_OPERAND (inner_types, 0);
        !          2461:       inner_types = TREE_OPERAND (inner_types, 1);
        !          2462:     }
        !          2463:   else
        !          2464:     {
        !          2465:       inner_name = inner_types;
        !          2466:       inner_types = NULL_TREE;
        !          2467:     }
        !          2468: 
        !          2469:   if (outer_type == NULL_TREE)
        !          2470:     {
        !          2471:       /* If we have something that's already a type by itself,
        !          2472:         use that.  */
        !          2473:       if (IDENTIFIER_HAS_TYPE_VALUE (inner_name))
        !          2474:        {
        !          2475:          if (inner_types)
        !          2476:            return resolve_scope_to_name (IDENTIFIER_TYPE_VALUE (inner_name),
        !          2477:                                          inner_types);
        !          2478:          return inner_name;
        !          2479:        }
        !          2480:       return NULL_TREE;
        !          2481:     }
        !          2482: 
        !          2483:   if (! IS_AGGR_TYPE (outer_type))
        !          2484:     return NULL_TREE;
        !          2485: 
        !          2486:   /* Look for member classes or enums.  */
        !          2487:   tmp = find_scoped_type (outer_type, inner_name, inner_types);
        !          2488: 
        !          2489:   /* If it's not a type in this class, then go down into the
        !          2490:      base classes and search there.  */
        !          2491:   if (! tmp && TYPE_BINFO (outer_type))
        !          2492:     {
        !          2493:       tree binfos = TYPE_BINFO_BASETYPES (outer_type);
        !          2494:       int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
        !          2495: 
        !          2496:       for (i = 0; i < n_baselinks; i++)
        !          2497:        {
        !          2498:          tree base_binfo = TREE_VEC_ELT (binfos, i);
        !          2499:          tmp = find_scoped_type (BINFO_TYPE (base_binfo),
        !          2500:                                  inner_name, inner_types);
        !          2501:          if (tmp)
        !          2502:            return tmp;
        !          2503:        }
        !          2504:       tmp = NULL_TREE;
        !          2505:     }
        !          2506: 
        !          2507:   return tmp;
        !          2508: }
        !          2509: 
        !          2510: /* Build a method call of the form `EXP->SCOPES::NAME (PARMS)'.
        !          2511:    This is how virtual function calls are avoided.  */
        !          2512: tree
        !          2513: build_scoped_method_call (exp, scopes, name, parms)
        !          2514:      tree exp, scopes, name, parms;
        !          2515: {
        !          2516:   /* Because this syntactic form does not allow
        !          2517:      a pointer to a base class to be `stolen',
        !          2518:      we need not protect the derived->base conversion
        !          2519:      that happens here.
        !          2520:      
        !          2521:      @@ But we do have to check visibility privileges later.  */
        !          2522:   tree basename = resolve_scope_to_name (NULL_TREE, scopes);
        !          2523:   tree basetype, binfo, decl;
        !          2524:   tree type = TREE_TYPE (exp);
        !          2525: 
        !          2526:   if (type == error_mark_node
        !          2527:       || basename == NULL_TREE)
        !          2528:     return error_mark_node;
        !          2529: 
        !          2530:   basetype = IDENTIFIER_TYPE_VALUE (basename);
        !          2531: 
        !          2532:   if (TREE_CODE (type) == REFERENCE_TYPE)
        !          2533:     type = TREE_TYPE (type);
        !          2534: 
        !          2535:   /* Destructors can be "called" for simple types; see 5.2.4 and 12.4 Note
        !          2536:      that explicit ~int is caught in the parser; this deals with typedefs
        !          2537:      and template parms.  */
        !          2538:   if (TREE_CODE (name) == BIT_NOT_EXPR && ! is_aggr_typedef (basename, 0))
        !          2539:     {
        !          2540:       if (type != basetype)
        !          2541:        cp_error ("type of `%E' does not match destructor type `%T' (type was `%T')",
        !          2542:                  exp, basetype, type);
        !          2543:       name = IDENTIFIER_TYPE_VALUE (TREE_OPERAND (name, 0));
        !          2544:       if (basetype != name)
        !          2545:        cp_error ("qualified type `%T' does not match destructor type `%T'",
        !          2546:                  basetype, name);
        !          2547:       return void_zero_node;
        !          2548:     }
        !          2549: 
        !          2550:   if (! is_aggr_typedef (basename, 1))
        !          2551:     return error_mark_node;
        !          2552: 
        !          2553:   if (! IS_AGGR_TYPE (type))
        !          2554:     {
        !          2555:       cp_error ("base object `%E' of scoped method call is of non-aggregate type `%T'",
        !          2556:                exp, type);
        !          2557:       return error_mark_node;
        !          2558:     }
        !          2559: 
        !          2560:   if (binfo = binfo_or_else (basetype, type))
        !          2561:     {
        !          2562:       if (binfo == error_mark_node)
        !          2563:        return error_mark_node;
        !          2564:       if (TREE_CODE (exp) == INDIRECT_REF)
        !          2565:        decl = build_indirect_ref (convert_pointer_to (binfo,
        !          2566:                                                       build_unary_op (ADDR_EXPR, exp, 0)), NULL_PTR);
        !          2567:       else
        !          2568:        decl = build_scoped_ref (exp, scopes);
        !          2569: 
        !          2570:       /* Call to a destructor.  */
        !          2571:       if (TREE_CODE (name) == BIT_NOT_EXPR)
        !          2572:        {
        !          2573:          /* Explicit call to destructor.  */
        !          2574:          name = TREE_OPERAND (name, 0);
        !          2575:          if (TREE_TYPE (decl) !=
        !          2576:              (IDENTIFIER_CLASS_VALUE (name)
        !          2577:               ? IDENTIFIER_CLASS_TYPE_VALUE (name)
        !          2578:               : IDENTIFIER_TYPE_VALUE (name)))
        !          2579:            {
        !          2580:              cp_error
        !          2581:                ("qualified type `%T' does not match destructor type `%T'",
        !          2582:                 TREE_TYPE (decl), name);
        !          2583:              return error_mark_node;
        !          2584:            }
        !          2585:          if (! TYPE_HAS_DESTRUCTOR (TREE_TYPE (decl)))
        !          2586:            return void_zero_node;
        !          2587:          
        !          2588:          return build_delete (TREE_TYPE (decl), decl, integer_two_node,
        !          2589:                               LOOKUP_NORMAL|LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR,
        !          2590:                               0);
        !          2591:        }
        !          2592: 
        !          2593:       /* Call to a method.  */
        !          2594:       return build_method_call (decl, name, parms, NULL_TREE,
        !          2595:                                LOOKUP_NORMAL|LOOKUP_NONVIRTUAL);
        !          2596:     }
        !          2597:   return error_mark_node;
        !          2598: }
        !          2599: 
        !          2600: /* Build something of the form ptr->method (args)
        !          2601:    or object.method (args).  This can also build
        !          2602:    calls to constructors, and find friends.
        !          2603: 
        !          2604:    Member functions always take their class variable
        !          2605:    as a pointer.
        !          2606: 
        !          2607:    INSTANCE is a class instance.
        !          2608: 
        !          2609:    NAME is the NAME field of the struct, union, or class
        !          2610:    whose type is that of INSTANCE.
        !          2611: 
        !          2612:    PARMS help to figure out what that NAME really refers to.
        !          2613: 
        !          2614:    BASETYPE_PATH, if non-NULL, tells which basetypes of INSTANCE
        !          2615:    we should be traversed before starting our search.  We need
        !          2616:    this information to get protected accesses correct.
        !          2617: 
        !          2618:    FLAGS is the logical disjunction of zero or more LOOKUP_
        !          2619:    flags.  See cp-tree.h for more info.
        !          2620: 
        !          2621:    If this is all OK, calls build_function_call with the resolved
        !          2622:    member function.
        !          2623: 
        !          2624:    This function must also handle being called to perform
        !          2625:    initialization, promotion/coercion of arguments, and
        !          2626:    instantiation of default parameters.
        !          2627: 
        !          2628:    Note that NAME may refer to an instance variable name.  If
        !          2629:    `operator()()' is defined for the type of that field, then we return
        !          2630:    that result.  */
        !          2631: tree
        !          2632: build_method_call (instance, name, parms, basetype_path, flags)
        !          2633:      tree instance, name, parms, basetype_path;
        !          2634:      int flags;
        !          2635: {
        !          2636:   register tree function, fntype, value_type;
        !          2637:   register tree basetype, save_basetype;
        !          2638:   register tree baselink, result, method_name, parmtypes, parm;
        !          2639:   tree last;
        !          2640:   int pass;
        !          2641:   enum visibility_type visibility;
        !          2642: 
        !          2643:   /* Range of cases for vtable optimization.  */
        !          2644:   enum vtable_needs { not_needed, maybe_needed, unneeded, needed };
        !          2645:   enum vtable_needs need_vtbl = not_needed;
        !          2646: 
        !          2647:   char *err_name;
        !          2648:   char *name_kind;
        !          2649:   int ever_seen = 0;
        !          2650:   tree instance_ptr = NULL_TREE;
        !          2651:   int all_virtual = flag_all_virtual;
        !          2652:   int static_call_context = 0;
        !          2653:   tree saw_private = NULL_TREE;
        !          2654:   tree saw_protected = NULL_TREE;
        !          2655: 
        !          2656:   /* Keep track of `const' and `volatile' objects.  */
        !          2657:   int constp, volatilep;
        !          2658: 
        !          2659: #ifdef GATHER_STATISTICS
        !          2660:   n_build_method_call++;
        !          2661: #endif
        !          2662: 
        !          2663:   if (instance == error_mark_node
        !          2664:       || name == error_mark_node
        !          2665:       || parms == error_mark_node
        !          2666:       || (instance != NULL_TREE && TREE_TYPE (instance) == error_mark_node))
        !          2667:     return error_mark_node;
        !          2668: 
        !          2669:   /* This is the logic that magically deletes the second argument to
        !          2670:      operator delete, if it is not needed. */
        !          2671:   if (name == ansi_opname[(int) DELETE_EXPR] && list_length (parms)==2)
        !          2672:     {
        !          2673:       tree save_last = TREE_CHAIN (parms);
        !          2674:       tree result;
        !          2675:       /* get rid of unneeded argument */
        !          2676:       TREE_CHAIN (parms) = NULL_TREE;
        !          2677:       result = build_method_call (instance, name, parms, basetype_path,
        !          2678:                                  (LOOKUP_SPECULATIVELY|flags)
        !          2679:                                  &~LOOKUP_COMPLAIN);
        !          2680:       /* If it works, return it. */
        !          2681:       if (result && result != error_mark_node)
        !          2682:        return build_method_call (instance, name, parms, basetype_path, flags);
        !          2683:       /* If it doesn't work, two argument delete must work */
        !          2684:       TREE_CHAIN (parms) = save_last;
        !          2685:     }
        !          2686: 
        !          2687:   if (TREE_CODE (name) == BIT_NOT_EXPR)
        !          2688:     {
        !          2689:       flags |= LOOKUP_DESTRUCTOR;
        !          2690:       name = TREE_OPERAND (name, 0);
        !          2691:       if (parms)
        !          2692:        error ("destructors take no parameters");
        !          2693:       basetype = IDENTIFIER_TYPE_VALUE (name);
        !          2694:       if (basetype == NULL_TREE)
        !          2695:        basetype = IDENTIFIER_CLASS_TYPE_VALUE (name);
        !          2696:       if (! TYPE_HAS_DESTRUCTOR (basetype))
        !          2697:        return void_zero_node;
        !          2698:       instance = default_conversion (instance);
        !          2699:       if (TREE_CODE (TREE_TYPE (instance)) == POINTER_TYPE)
        !          2700:        instance_ptr = instance;
        !          2701:       else
        !          2702:        instance_ptr = build_unary_op (ADDR_EXPR, instance, 0);
        !          2703:       return build_delete (build_pointer_type (basetype),
        !          2704:                           instance_ptr, integer_two_node,
        !          2705:                           LOOKUP_NORMAL|LOOKUP_DESTRUCTOR, 0);
        !          2706:     }
        !          2707: 
        !          2708:   /* Initialize name for error reporting.  */
        !          2709:   if (IDENTIFIER_TYPENAME_P (name))
        !          2710:     err_name = "type conversion operator";
        !          2711:   else if (IDENTIFIER_OPNAME_P (name))
        !          2712:     {
        !          2713:       char *p = operator_name_string (name);
        !          2714:       err_name = (char *)alloca (strlen (p) + 10);
        !          2715:       sprintf (err_name, "operator %s", p);
        !          2716:     }
        !          2717:   else if (TREE_CODE (name) == SCOPE_REF)
        !          2718:     err_name = IDENTIFIER_POINTER (TREE_OPERAND (name, 1));
        !          2719:   else
        !          2720:     err_name = IDENTIFIER_POINTER (name);
        !          2721: 
        !          2722:   if (IDENTIFIER_OPNAME_P (name))
        !          2723:     GNU_xref_call (current_function_decl,  IDENTIFIER_POINTER (name));
        !          2724:   else
        !          2725:     GNU_xref_call (current_function_decl, err_name);
        !          2726: 
        !          2727:   if (instance == NULL_TREE)
        !          2728:     {
        !          2729:       basetype = NULL_TREE;
        !          2730:       /* Check cases where this is really a call to raise
        !          2731:         an exception.  */
        !          2732:       if (current_class_type && TREE_CODE (name) == IDENTIFIER_NODE)
        !          2733:        {
        !          2734:          basetype = purpose_member (name, CLASSTYPE_TAGS (current_class_type));
        !          2735:          if (basetype)
        !          2736:            basetype = TREE_VALUE (basetype);
        !          2737:        }
        !          2738:       else if (TREE_CODE (name) == SCOPE_REF
        !          2739:               && TREE_CODE (TREE_OPERAND (name, 0)) == IDENTIFIER_NODE)
        !          2740:        {
        !          2741:          if (! is_aggr_typedef (TREE_OPERAND (name, 0), 1))
        !          2742:            return error_mark_node;
        !          2743:          basetype = purpose_member (TREE_OPERAND (name, 1),
        !          2744:                                     CLASSTYPE_TAGS (IDENTIFIER_TYPE_VALUE (TREE_OPERAND (name, 0))));
        !          2745:          if (basetype)
        !          2746:            basetype = TREE_VALUE (basetype);
        !          2747:        }
        !          2748: 
        !          2749:       if (basetype != NULL_TREE)
        !          2750:        ;
        !          2751:       /* call to a constructor... */
        !          2752:       else if (IDENTIFIER_HAS_TYPE_VALUE (name))
        !          2753:        {
        !          2754:          basetype = IDENTIFIER_TYPE_VALUE (name);
        !          2755:          name = constructor_name_full (basetype);
        !          2756:        }
        !          2757:       else
        !          2758:        {
        !          2759:          tree typedef_name = lookup_name (name, 1);
        !          2760:          if (typedef_name && TREE_CODE (typedef_name) == TYPE_DECL)
        !          2761:            {
        !          2762:              /* Canonicalize the typedef name.  */
        !          2763:              basetype = TREE_TYPE (typedef_name);
        !          2764:              name = TYPE_IDENTIFIER (basetype);
        !          2765:            }
        !          2766:          else
        !          2767:            {
        !          2768:              cp_error ("no constructor named `%T' in visible scope",
        !          2769:                        name);
        !          2770:              return error_mark_node;
        !          2771:            }
        !          2772:        }
        !          2773: 
        !          2774:       if (! IS_AGGR_TYPE (basetype))
        !          2775:        {
        !          2776:        non_aggr_error:
        !          2777:          if ((flags & LOOKUP_COMPLAIN) && TREE_CODE (basetype) != ERROR_MARK)
        !          2778:            error ("request for member `%s' in something not a structure or union", err_name);
        !          2779: 
        !          2780:          return error_mark_node;
        !          2781:        }
        !          2782:     }
        !          2783:   else if (instance == C_C_D || instance == current_class_decl)
        !          2784:     {
        !          2785:       /* When doing initialization, we side-effect the TREE_TYPE of
        !          2786:         C_C_D, hence we cannot set up BASETYPE from CURRENT_CLASS_TYPE.  */
        !          2787:       basetype = TREE_TYPE (C_C_D);
        !          2788: 
        !          2789:       /* Anything manifestly `this' in constructors and destructors
        !          2790:         has a known type, so virtual function tables are not needed.  */
        !          2791:       if (TYPE_VIRTUAL_P (basetype)
        !          2792:          && !(flags & LOOKUP_NONVIRTUAL))
        !          2793:        need_vtbl = (dtor_label || ctor_label)
        !          2794:          ? unneeded : maybe_needed;
        !          2795: 
        !          2796:       instance = C_C_D;
        !          2797:       instance_ptr = current_class_decl;
        !          2798:       result = build_field_call (TYPE_BINFO (current_class_type),
        !          2799:                                 instance_ptr, name, parms, err_name);
        !          2800: 
        !          2801:       if (result)
        !          2802:        return result;
        !          2803:     }
        !          2804:   else if (TREE_CODE (instance) == RESULT_DECL)
        !          2805:     {
        !          2806:       basetype = TREE_TYPE (instance);
        !          2807:       /* Should we ever have to make a virtual function reference
        !          2808:         from a RESULT_DECL, know that it must be of fixed type
        !          2809:         within the scope of this function.  */
        !          2810:       if (!(flags & LOOKUP_NONVIRTUAL) && TYPE_VIRTUAL_P (basetype))
        !          2811:        need_vtbl = maybe_needed;
        !          2812:       instance_ptr = build1 (ADDR_EXPR, TYPE_POINTER_TO (basetype), instance);
        !          2813:     }
        !          2814:   else if (instance == current_exception_object)
        !          2815:     {
        !          2816:       instance_ptr = build1 (ADDR_EXPR, TYPE_POINTER_TO (current_exception_type),
        !          2817:                            TREE_OPERAND (current_exception_object, 0));
        !          2818:       mark_addressable (TREE_OPERAND (current_exception_object, 0));
        !          2819:       result = build_field_call (TYPE_BINFO (current_exception_type),
        !          2820:                                 instance_ptr, name, parms, err_name);
        !          2821:       if (result)
        !          2822:        return result;
        !          2823:       error ("exception member `%s' cannot be invoked", err_name);
        !          2824:       return error_mark_node;
        !          2825:     }
        !          2826:   else
        !          2827:     {
        !          2828:       /* The MAIN_VARIANT of the type that `instance_ptr' winds up being.  */
        !          2829:       tree inst_ptr_basetype;
        !          2830: 
        !          2831:       static_call_context = (TREE_CODE (instance) == NOP_EXPR
        !          2832:                             && TREE_OPERAND (instance, 0) == error_mark_node);
        !          2833: 
        !          2834:       /* the base type of an instance variable is pointer to class */
        !          2835:       basetype = TREE_TYPE (instance);
        !          2836: 
        !          2837:       if (TREE_CODE (basetype) == REFERENCE_TYPE)
        !          2838:        {
        !          2839:          basetype = TYPE_MAIN_VARIANT (TREE_TYPE (basetype));
        !          2840:          if (! IS_AGGR_TYPE (basetype))
        !          2841:            goto non_aggr_error;
        !          2842:          /* Call to convert not needed because we are remaining
        !          2843:             within the same type.  */
        !          2844:          instance_ptr = build1 (NOP_EXPR, TYPE_POINTER_TO (basetype), instance);
        !          2845:          inst_ptr_basetype = basetype;
        !          2846:        }
        !          2847:       else
        !          2848:        {
        !          2849:          if (TREE_CODE (basetype) == POINTER_TYPE)
        !          2850:            {
        !          2851:              basetype = TREE_TYPE (basetype);
        !          2852:              instance_ptr = instance;
        !          2853:            }
        !          2854: 
        !          2855:          if (! IS_AGGR_TYPE (basetype))
        !          2856:            goto non_aggr_error;
        !          2857: 
        !          2858:          if (! instance_ptr)
        !          2859:            {
        !          2860:              if ((lvalue_p (instance)
        !          2861:                   && (instance_ptr = build_unary_op (ADDR_EXPR, instance, 0)))
        !          2862:                  || (instance_ptr = unary_complex_lvalue (ADDR_EXPR, instance)))
        !          2863:                {
        !          2864:                  if (instance_ptr == error_mark_node)
        !          2865:                    return error_mark_node;
        !          2866:                }
        !          2867:              else if (TREE_CODE (instance) == NOP_EXPR
        !          2868:                       || TREE_CODE (instance) == CONSTRUCTOR)
        !          2869:                {
        !          2870:                  /* A cast is not an lvalue.  Initialize a fresh temp
        !          2871:                     with the value we are casting from, and proceed with
        !          2872:                     that temporary.  We can't cast to a reference type,
        !          2873:                     so that simplifies the initialization to something
        !          2874:                     we can manage.  */
        !          2875:                  tree temp = get_temp_name (TREE_TYPE (instance), 0);
        !          2876:                  if (IS_AGGR_TYPE (TREE_TYPE (instance)))
        !          2877:                    expand_aggr_init (temp, instance, 0);
        !          2878:                  else
        !          2879:                    {
        !          2880:                      store_init_value (temp, instance);
        !          2881:                      expand_decl_init (temp);
        !          2882:                    }
        !          2883:                  instance = temp;
        !          2884:                  instance_ptr = build_unary_op (ADDR_EXPR, instance, 0);
        !          2885:                }
        !          2886:              else
        !          2887:                {
        !          2888:                  if (TREE_CODE (instance) != CALL_EXPR)
        !          2889:                    my_friendly_abort (125);
        !          2890:                  if (TYPE_NEEDS_CONSTRUCTOR (basetype))
        !          2891:                    instance = build_cplus_new (basetype, instance, 0);
        !          2892:                  else
        !          2893:                    {
        !          2894:                      instance = get_temp_name (basetype, 0);
        !          2895:                      TREE_ADDRESSABLE (instance) = 1;
        !          2896:                    }
        !          2897:                  instance_ptr = build_unary_op (ADDR_EXPR, instance, 0);
        !          2898:                }
        !          2899:              /* @@ Should we call comp_target_types here?  */
        !          2900:              inst_ptr_basetype = TREE_TYPE (TREE_TYPE (instance_ptr));
        !          2901:              if (TYPE_MAIN_VARIANT (basetype) == TYPE_MAIN_VARIANT (inst_ptr_basetype))
        !          2902:                basetype = inst_ptr_basetype;
        !          2903:              else
        !          2904:                {
        !          2905:                  instance_ptr = convert (TYPE_POINTER_TO (basetype), instance_ptr);
        !          2906:                  if (instance_ptr == error_mark_node)
        !          2907:                    return error_mark_node;
        !          2908:                }
        !          2909:            }
        !          2910:          else
        !          2911:            inst_ptr_basetype = TREE_TYPE (TREE_TYPE (instance_ptr));
        !          2912:        }
        !          2913: 
        !          2914:       if (basetype_path == NULL_TREE)
        !          2915:        basetype_path = TYPE_BINFO (inst_ptr_basetype);
        !          2916: 
        !          2917:       result = build_field_call (basetype_path, instance_ptr, name, parms, err_name);
        !          2918:       if (result)
        !          2919:        return result;
        !          2920: 
        !          2921:       if (!(flags & LOOKUP_NONVIRTUAL) && TYPE_VIRTUAL_P (basetype))
        !          2922:        {
        !          2923:          if (TREE_SIDE_EFFECTS (instance_ptr))
        !          2924:            {
        !          2925:              /* This action is needed because the instance is needed
        !          2926:                 for providing the base of the virtual function table.
        !          2927:                 Without using a SAVE_EXPR, the function we are building
        !          2928:                 may be called twice, or side effects on the instance
        !          2929:                 variable (such as a post-increment), may happen twice.  */
        !          2930:              instance_ptr = save_expr (instance_ptr);
        !          2931:              instance = build_indirect_ref (instance_ptr, NULL_PTR);
        !          2932:            }
        !          2933:          else if (TREE_CODE (TREE_TYPE (instance)) == POINTER_TYPE)
        !          2934:            {
        !          2935:              /* This happens when called for operator new ().  */
        !          2936:              instance = build_indirect_ref (instance, NULL_PTR);
        !          2937:            }
        !          2938: 
        !          2939:          need_vtbl = maybe_needed;
        !          2940:        }
        !          2941:     }
        !          2942: 
        !          2943:   if (TYPE_SIZE (basetype) == 0)
        !          2944:     {
        !          2945:       /* This is worth complaining about, I think.  */
        !          2946:       cp_error ("cannot lookup method in incomplete type `%T'", basetype);
        !          2947:       return error_mark_node;
        !          2948:     }
        !          2949: 
        !          2950:   save_basetype = basetype;
        !          2951: 
        !          2952: #if 0
        !          2953:   if (all_virtual == 1
        !          2954:       && (! strncmp (IDENTIFIER_POINTER (name), OPERATOR_METHOD_FORMAT,
        !          2955:                     OPERATOR_METHOD_LENGTH)
        !          2956:          || instance_ptr == NULL_TREE
        !          2957:          || (TYPE_OVERLOADS_METHOD_CALL_EXPR (basetype) == 0)))
        !          2958:     all_virtual = 0;
        !          2959: #endif
        !          2960: 
        !          2961:   last = NULL_TREE;
        !          2962:   for (parmtypes = NULL_TREE, parm = parms; parm; parm = TREE_CHAIN (parm))
        !          2963:     {
        !          2964:       tree t = TREE_TYPE (TREE_VALUE (parm));
        !          2965:       if (TREE_CODE (t) == OFFSET_TYPE)
        !          2966:        {
        !          2967:          /* Convert OFFSET_TYPE entities to their normal selves.  */
        !          2968:          TREE_VALUE (parm) = resolve_offset_ref (TREE_VALUE (parm));
        !          2969:          t = TREE_TYPE (TREE_VALUE (parm));
        !          2970:        }
        !          2971:       if (TREE_CODE (t) == ARRAY_TYPE)
        !          2972:        {
        !          2973:          /* Perform the conversion from ARRAY_TYPE to POINTER_TYPE in place.
        !          2974:             This eliminates needless calls to `compute_conversion_costs'.  */
        !          2975:          TREE_VALUE (parm) = default_conversion (TREE_VALUE (parm));
        !          2976:          t = TREE_TYPE (TREE_VALUE (parm));
        !          2977:        }
        !          2978:       if (t == error_mark_node)
        !          2979:        return error_mark_node;
        !          2980:       last = build_tree_list (NULL_TREE, t);
        !          2981:       parmtypes = chainon (parmtypes, last);
        !          2982:     }
        !          2983: 
        !          2984:   if (instance)
        !          2985:     {
        !          2986:       constp = TREE_READONLY (instance);
        !          2987:       volatilep = TREE_THIS_VOLATILE (instance);
        !          2988:       parms = tree_cons (NULL_TREE, instance_ptr, parms);
        !          2989:     }
        !          2990:   else
        !          2991:     {
        !          2992:       /* Raw constructors are always in charge.  */
        !          2993:       if (TYPE_USES_VIRTUAL_BASECLASSES (basetype)
        !          2994:          && ! (flags & LOOKUP_HAS_IN_CHARGE))
        !          2995:        {
        !          2996:          flags |= LOOKUP_HAS_IN_CHARGE;
        !          2997:          parms = tree_cons (NULL_TREE, integer_one_node, parms);
        !          2998:          parmtypes = tree_cons (NULL_TREE, integer_type_node, parmtypes);
        !          2999:        }
        !          3000: 
        !          3001:       if (flag_this_is_variable > 0)
        !          3002:        {
        !          3003:          constp = 0;
        !          3004:          volatilep = 0;
        !          3005:          parms = tree_cons (NULL_TREE, build1 (NOP_EXPR, TYPE_POINTER_TO (basetype), integer_zero_node), parms);
        !          3006:        }
        !          3007:       else
        !          3008:        {
        !          3009:          constp = 0;
        !          3010:          volatilep = 0;
        !          3011:          instance_ptr = build_new (NULL_TREE, basetype, void_type_node, 0);
        !          3012:          if (instance_ptr == error_mark_node)
        !          3013:            return error_mark_node;
        !          3014:          instance_ptr = save_expr (instance_ptr);
        !          3015:          TREE_CALLS_NEW (instance_ptr) = 1;
        !          3016:          instance = build_indirect_ref (instance_ptr, NULL_PTR);
        !          3017: 
        !          3018:          /* If it's a default argument initialized from a ctor, what we get
        !          3019:             from instance_ptr will match the arglist for the FUNCTION_DECL
        !          3020:             of the constructor.  */
        !          3021:          if (parms && TREE_CODE (TREE_VALUE (parms)) == CALL_EXPR
        !          3022:              && TREE_OPERAND (TREE_VALUE (parms), 1)
        !          3023:              && TREE_CALLS_NEW (TREE_VALUE (TREE_OPERAND (TREE_VALUE (parms), 1))))
        !          3024:            parms = build_tree_list (NULL_TREE, instance_ptr);
        !          3025:          else
        !          3026:            parms = tree_cons (NULL_TREE, instance_ptr, parms);
        !          3027:        }
        !          3028:     }
        !          3029:   parmtypes = tree_cons (NULL_TREE,
        !          3030:                         build_pointer_type (build_type_variant (basetype, constp, volatilep)),
        !          3031:                         parmtypes);
        !          3032:   if (last == NULL_TREE)
        !          3033:     last = parmtypes;
        !          3034: 
        !          3035:   /* Look up function name in the structure type definition.  */
        !          3036: 
        !          3037:   if ((IDENTIFIER_HAS_TYPE_VALUE (name)
        !          3038:        && IS_AGGR_TYPE (IDENTIFIER_TYPE_VALUE (name)))
        !          3039:       || name == constructor_name (basetype))
        !          3040:     {
        !          3041:       tree tmp = NULL_TREE;
        !          3042:       if (IDENTIFIER_TYPE_VALUE (name) == basetype
        !          3043:          || name == constructor_name (basetype))
        !          3044:        tmp = TYPE_BINFO (basetype);
        !          3045:       else
        !          3046:        tmp = get_binfo (IDENTIFIER_TYPE_VALUE (name), basetype, 0);
        !          3047:       
        !          3048:       if (tmp != NULL_TREE)
        !          3049:        {
        !          3050:          name_kind = "constructor";
        !          3051:          
        !          3052:          if (TYPE_USES_VIRTUAL_BASECLASSES (basetype)
        !          3053:              && ! (flags & LOOKUP_HAS_IN_CHARGE))
        !          3054:            {
        !          3055:              /* Constructors called for initialization
        !          3056:                 only are never in charge.  */
        !          3057:              tree tmplist;
        !          3058:              
        !          3059:              flags |= LOOKUP_HAS_IN_CHARGE;
        !          3060:              tmplist = tree_cons (NULL_TREE, integer_zero_node,
        !          3061:                                   TREE_CHAIN (parms));
        !          3062:              TREE_CHAIN (parms) = tmplist;
        !          3063:              tmplist = tree_cons (NULL_TREE, integer_type_node, TREE_CHAIN (parmtypes));
        !          3064:              TREE_CHAIN (parmtypes) = tmplist;
        !          3065:            }
        !          3066:          basetype = BINFO_TYPE (tmp);
        !          3067:        }
        !          3068:       else
        !          3069:        name_kind = "method";
        !          3070:     }
        !          3071:   else
        !          3072:     name_kind = "method";
        !          3073:   
        !          3074:   if (basetype_path == NULL_TREE)
        !          3075:     basetype_path = TYPE_BINFO (basetype);
        !          3076:   result = lookup_fnfields (basetype_path, name,
        !          3077:                            (flags & LOOKUP_COMPLAIN));
        !          3078:   if (result == error_mark_node)
        !          3079:     return error_mark_node;
        !          3080: 
        !          3081: 
        !          3082:   /* Now, go look for this method name.  We do not find destructors here.
        !          3083: 
        !          3084:      Putting `void_list_node' on the end of the parmtypes
        !          3085:      fakes out `build_decl_overload' into doing the right thing.  */
        !          3086:   TREE_CHAIN (last) = void_list_node;
        !          3087:   method_name = build_decl_overload (name, parmtypes,
        !          3088:                                     1 + (name == constructor_name (save_basetype)
        !          3089:                                          || name == constructor_name_full (save_basetype)));
        !          3090:   TREE_CHAIN (last) = NULL_TREE;
        !          3091: 
        !          3092:   for (pass = 0; pass < 2; pass++)
        !          3093:     {
        !          3094:       struct candidate *candidates;
        !          3095:       struct candidate *cp;
        !          3096:       int len;
        !          3097:       unsigned best = 1;
        !          3098: 
        !          3099:       /* This increments every time we go up the type hierarchy.
        !          3100:         The idea is to prefer a function of the derived class if possible. */
        !          3101:       int b_or_d = 0;
        !          3102: 
        !          3103:       baselink = result;
        !          3104: 
        !          3105:       if (pass > 0)
        !          3106:        {
        !          3107:          candidates
        !          3108:            = (struct candidate *) alloca ((ever_seen+1)
        !          3109:                                           * sizeof (struct candidate));
        !          3110:          bzero (candidates, (ever_seen + 1) * sizeof (struct candidate));
        !          3111:          cp = candidates;
        !          3112:          len = list_length (parms);
        !          3113: 
        !          3114:          /* First see if a global function has a shot at it.  */
        !          3115:          if (flags & LOOKUP_GLOBAL)
        !          3116:            {
        !          3117:              tree friend_parms;
        !          3118:              tree parm = TREE_VALUE (parms);
        !          3119: 
        !          3120:              if (TREE_CODE (TREE_TYPE (parm)) == REFERENCE_TYPE)
        !          3121:                friend_parms = parms;
        !          3122:              else if (TREE_CODE (TREE_TYPE (parm)) == POINTER_TYPE)
        !          3123:                {
        !          3124:                  tree new_type;
        !          3125:                  parm = build_indirect_ref (parm, "friendifying parms (compiler error)");
        !          3126:                  new_type = build_reference_type (TREE_TYPE (parm));
        !          3127:                  /* It is possible that this should go down a layer. */
        !          3128:                  new_type = build_type_variant (new_type,
        !          3129:                                                 TREE_READONLY (parm),
        !          3130:                                                 TREE_THIS_VOLATILE (parm));
        !          3131:                  parm = convert (new_type, parm);
        !          3132:                  friend_parms = tree_cons (NULL_TREE, parm, TREE_CHAIN (parms));
        !          3133:                }
        !          3134:              else
        !          3135:                my_friendly_abort (167);
        !          3136: 
        !          3137:              if (flag_ansi_overloading)
        !          3138:                {
        !          3139:                  cp->v.ansi_harshness
        !          3140:                    = (struct harshness_code *)alloca ((len+1) * sizeof (struct harshness_code));
        !          3141:                  cp->h_len = len;
        !          3142:                }
        !          3143:              else
        !          3144:                cp->v.old_harshness
        !          3145:                  = (unsigned short *)alloca ((len+1) * sizeof (short));
        !          3146: 
        !          3147:              result = build_overload_call (name, friend_parms, 0, cp);
        !          3148:              /* If it turns out to be the one we were actually looking for
        !          3149:                 (it was probably a friend function), the return the
        !          3150:                 good result.  */
        !          3151:              if (TREE_CODE (result) == CALL_EXPR)
        !          3152:                return result;
        !          3153: 
        !          3154:              if (flag_ansi_overloading)
        !          3155:                while ((cp->h.code & EVIL_CODE) == 0)
        !          3156:                  {
        !          3157:                    /* non-standard uses: set the field to 0 to indicate
        !          3158:                       we are using a non-member function.  */
        !          3159:                    cp->u.field = 0;
        !          3160:                    if (cp->v.ansi_harshness[len].distance == 0
        !          3161:                        && cp->h.code < best)
        !          3162:                      best = cp->h.code;
        !          3163:                    cp += 1;
        !          3164:                  }
        !          3165:              else
        !          3166:                while (cp->evil == 0)
        !          3167:                  {
        !          3168:                    /* non-standard uses: set the field to 0 to indicate
        !          3169:                       we are using a non-member function.  */
        !          3170:                    cp->u.field = 0;
        !          3171:                    if (cp->v.old_harshness[len] == 0
        !          3172:                        && cp->v.old_harshness[len] == 0
        !          3173:                        && cp->ellipsis == 0 && cp->user == 0 && cp->b_or_d == 0
        !          3174:                        && cp->easy < best)
        !          3175:                      best = cp->easy;
        !          3176:                    cp += 1;
        !          3177:                  }
        !          3178:            }
        !          3179:        }
        !          3180: 
        !          3181:       while (baselink)
        !          3182:        {
        !          3183:          /* We have a hit (of sorts). If the parameter list is
        !          3184:             "error_mark_node", or some variant thereof, it won't
        !          3185:             match any methods.  Since we have verified that the is
        !          3186:             some method vaguely matching this one (in name at least),
        !          3187:             silently return.
        !          3188:             
        !          3189:             Don't stop for friends, however.  */
        !          3190:          tree basetypes = TREE_PURPOSE (baselink);
        !          3191: 
        !          3192:          function = TREE_VALUE (baselink);
        !          3193:          if (TREE_CODE (basetypes) == TREE_LIST)
        !          3194:            basetypes = TREE_VALUE (basetypes);
        !          3195:          basetype = BINFO_TYPE (basetypes);
        !          3196: 
        !          3197:          /* Cast the instance variable to the appropriate type.  */
        !          3198:          TREE_VALUE (parmtypes) = TYPE_POINTER_TO (basetype);
        !          3199: 
        !          3200:          if (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (function)))
        !          3201:            function = DECL_CHAIN (function);
        !          3202: 
        !          3203:          for (; function; function = DECL_CHAIN (function))
        !          3204:            {
        !          3205: #ifdef GATHER_STATISTICS
        !          3206:              n_inner_fields_searched++;
        !          3207: #endif
        !          3208:              ever_seen++;
        !          3209: 
        !          3210:              /* Not looking for friends here.  */
        !          3211:              if (TREE_CODE (TREE_TYPE (function)) == FUNCTION_TYPE
        !          3212:                  && ! DECL_STATIC_FUNCTION_P (function))
        !          3213:                continue;
        !          3214: 
        !          3215:              if (pass == 0
        !          3216:                  && DECL_ASSEMBLER_NAME (function) == method_name)
        !          3217:                {
        !          3218:                  if (flags & LOOKUP_PROTECT)
        !          3219:                    {
        !          3220:                      visibility = compute_visibility (basetypes, function);
        !          3221:                      if (visibility == visibility_protected
        !          3222:                          && flags & LOOKUP_PROTECTED_OK)
        !          3223:                        visibility = visibility_public;
        !          3224:                    }
        !          3225: 
        !          3226:                  if ((flags & LOOKUP_PROTECT) == 0
        !          3227:                      || visibility == visibility_public)
        !          3228:                    goto found_and_ok;
        !          3229:                  else if (visibility == visibility_private)
        !          3230:                    saw_private = function;
        !          3231:                  else if (visibility == visibility_protected)
        !          3232:                    saw_protected = function;
        !          3233:                  /* If we fail on the exact match, we have
        !          3234:                     an immediate failure.  */
        !          3235:                  goto found;
        !          3236:                }
        !          3237:              if (pass > 0)
        !          3238:                {
        !          3239:                  tree these_parms = parms;
        !          3240: 
        !          3241: #ifdef GATHER_STATISTICS
        !          3242:                  n_inner_fields_searched++;
        !          3243: #endif
        !          3244:                  if (flag_ansi_overloading)
        !          3245:                    {
        !          3246:                      cp->v.ansi_harshness
        !          3247:                        = (struct harshness_code *)alloca ((len+1) * sizeof (struct harshness_code));
        !          3248:                      cp->h_len = len;
        !          3249:                    }
        !          3250:                  else
        !          3251:                    cp->v.old_harshness
        !          3252:                      = (unsigned short *)alloca ((len+1) * sizeof (short));
        !          3253: 
        !          3254:                  if (DECL_STATIC_FUNCTION_P (function))
        !          3255:                    these_parms = TREE_CHAIN (these_parms);
        !          3256:                  compute_conversion_costs (function, these_parms, cp, len);
        !          3257: 
        !          3258:                  if (!flag_ansi_overloading)
        !          3259:                      cp->b_or_d += b_or_d;
        !          3260: 
        !          3261:                  if ((flag_ansi_overloading && (cp->h.code & EVIL_CODE) == 0)
        !          3262:                      || (!flag_ansi_overloading && cp->evil == 0))
        !          3263:                    {
        !          3264:                      cp->u.field = function;
        !          3265:                      cp->function = function;
        !          3266:                      if (flags & LOOKUP_PROTECT)
        !          3267:                        {
        !          3268:                          enum visibility_type this_v;
        !          3269:                          this_v = compute_visibility (basetypes, function);
        !          3270:                          if (this_v == visibility_protected
        !          3271:                              && (flags & LOOKUP_PROTECTED_OK))
        !          3272:                            this_v = visibility_public;
        !          3273:                          if (this_v != visibility_public)
        !          3274:                            {
        !          3275:                              if (this_v == visibility_private)
        !          3276:                                saw_private = function;
        !          3277:                              else
        !          3278:                                saw_protected = function;
        !          3279:                              continue;
        !          3280:                            }
        !          3281:                        }
        !          3282: 
        !          3283:                      /* No "two-level" conversions.  */
        !          3284:                      if (flags & LOOKUP_NO_CONVERSION
        !          3285:                          && ((flag_ansi_overloading
        !          3286:                               && (cp->h.code & USER_CODE))
        !          3287:                              || (!flag_ansi_overloading
        !          3288:                                  && cp->user != 0)))
        !          3289:                        continue;
        !          3290: 
        !          3291:                      /* If we used default parameters, we must
        !          3292:                         check to see whether anyone else might
        !          3293:                         use them also, and report a possible
        !          3294:                         ambiguity.  */
        !          3295:                      if (! TYPE_USES_MULTIPLE_INHERITANCE (save_basetype)
        !          3296:                          && ((flag_ansi_overloading
        !          3297:                               && cp->v.ansi_harshness[len].distance == 0
        !          3298:                               && cp->h.code < best)
        !          3299:                              || (!flag_ansi_overloading
        !          3300:                                  && cp->v.old_harshness[len] == 0
        !          3301:                                  && CONST_HARSHNESS (cp->v.old_harshness[0]) == 0
        !          3302:                                  && cp->ellipsis == 0 && cp->user == 0 && cp->b_or_d == 0
        !          3303:                                  && cp->easy < best)))
        !          3304:                        {
        !          3305:                          if (! DECL_STATIC_FUNCTION_P (function))
        !          3306:                            TREE_VALUE (parms) = cp->arg;
        !          3307:                          if (best == 1)
        !          3308:                            goto found_and_maybe_warn;
        !          3309:                        }
        !          3310:                      cp++;
        !          3311:                    }
        !          3312:                }
        !          3313:            }
        !          3314:          /* Now we have run through one link's member functions.
        !          3315:             arrange to head-insert this link's links.  */
        !          3316:          baselink = next_baselink (baselink);
        !          3317:          b_or_d += 1;
        !          3318:          /* Don't grab functions from base classes.  lookup_fnfield will
        !          3319:             do the work to get us down into the right place.  */
        !          3320:          baselink = NULL_TREE;
        !          3321:        }
        !          3322:       if (pass == 0)
        !          3323:        {
        !          3324:          tree igv = IDENTIFIER_GLOBAL_VALUE (name);
        !          3325: 
        !          3326:          /* No exact match could be found.  Now try to find match
        !          3327:             using default conversions.  */
        !          3328:          if ((flags & LOOKUP_GLOBAL) && igv)
        !          3329:            {
        !          3330:              if (TREE_CODE (igv) == FUNCTION_DECL)
        !          3331:                ever_seen += 1;
        !          3332:              else if (TREE_CODE (igv) == TREE_LIST)
        !          3333:                ever_seen += list_length (igv);
        !          3334:            }
        !          3335: 
        !          3336:          if (ever_seen == 0)
        !          3337:            {
        !          3338:              if ((flags & (LOOKUP_SPECULATIVELY|LOOKUP_COMPLAIN))
        !          3339:                  == LOOKUP_SPECULATIVELY)
        !          3340:                return NULL_TREE;
        !          3341:              if (flags & LOOKUP_GLOBAL)
        !          3342:                error ("no global or non-hidden member function `%s' defined", err_name);
        !          3343:              else
        !          3344:                cp_error ("no non-hidden member function `%T::%s' defined", save_basetype, err_name);
        !          3345:              return error_mark_node;
        !          3346:            }
        !          3347:          continue;
        !          3348:        }
        !          3349: 
        !          3350:       if (cp - candidates != 0)
        !          3351:        {
        !          3352:          /* Rank from worst to best.  Then cp will point to best one.
        !          3353:             Private fields have their bits flipped.  For unsigned
        !          3354:             numbers, this should make them look very large.
        !          3355:             If the best alternate has a (signed) negative value,
        !          3356:             then all we ever saw were private members.  */
        !          3357:          if (cp - candidates > 1)
        !          3358:            {
        !          3359:              cp = ideal_candidate (save_basetype, candidates,
        !          3360:                                    cp - candidates, parms, len);
        !          3361:              if (cp == (struct candidate *)0)
        !          3362:                {
        !          3363:                  error ("ambiguous type conversion requested for %s `%s'",
        !          3364:                         name_kind, err_name);
        !          3365:                  return error_mark_node;
        !          3366:                }
        !          3367:              if ((flag_ansi_overloading && (cp->h.code & EVIL_CODE))
        !          3368:                  || (!flag_ansi_overloading && cp->evil))
        !          3369:                return error_mark_node;
        !          3370:            }
        !          3371:          else if ((flag_ansi_overloading && (cp[-1].h.code & EVIL_CODE))
        !          3372:                   || (!flag_ansi_overloading && cp[-1].evil == 2))
        !          3373:            {
        !          3374:              error ("ambiguous type conversion requested for %s `%s'",
        !          3375:                     name_kind, err_name);
        !          3376:              return error_mark_node;
        !          3377:            }
        !          3378:          else
        !          3379:            cp--;
        !          3380: 
        !          3381:          /* The global function was the best, so use it.  */
        !          3382:          if (cp->u.field == 0)
        !          3383:            {
        !          3384:              /* We must convert the instance pointer into a reference type.
        !          3385:                 Global overloaded functions can only either take
        !          3386:                 aggregate objects (which come for free from references)
        !          3387:                 or reference data types anyway.  */
        !          3388:              TREE_VALUE (parms) = copy_node (instance_ptr);
        !          3389:              TREE_TYPE (TREE_VALUE (parms)) = build_reference_type (TREE_TYPE (TREE_TYPE (instance_ptr)));
        !          3390:              return build_function_call (cp->function, parms);
        !          3391:            }
        !          3392: 
        !          3393:          function = cp->function;
        !          3394:          if (! DECL_STATIC_FUNCTION_P (function))
        !          3395:            TREE_VALUE (parms) = cp->arg;
        !          3396:          goto found_and_maybe_warn;
        !          3397:        }
        !          3398: 
        !          3399:       if ((flags & ~LOOKUP_GLOBAL) & (LOOKUP_COMPLAIN|LOOKUP_SPECULATIVELY))
        !          3400:        {
        !          3401:          char *tag_name, *buf;
        !          3402: 
        !          3403:          if ((flags & (LOOKUP_SPECULATIVELY|LOOKUP_COMPLAIN))
        !          3404:              == LOOKUP_SPECULATIVELY)
        !          3405:            return NULL_TREE;
        !          3406: 
        !          3407:          if (DECL_STATIC_FUNCTION_P (cp->function))
        !          3408:            parms = TREE_CHAIN (parms);
        !          3409:          if (ever_seen)
        !          3410:            {
        !          3411:              if (((HOST_WIDE_INT)saw_protected|(HOST_WIDE_INT)saw_private) == 0)
        !          3412:                {
        !          3413:                  if (flags & LOOKUP_SPECULATIVELY)
        !          3414:                    return NULL_TREE;
        !          3415:                  if (static_call_context && TREE_CODE (TREE_TYPE (cp->function)) == METHOD_TYPE)
        !          3416:                    cp_error ("object missing in call to `%T::%s'",
        !          3417:                                TREE_TYPE (TREE_TYPE (instance_ptr)),
        !          3418:                                err_name);
        !          3419:                  else
        !          3420:                    report_type_mismatch (cp, parms, name_kind, err_name);
        !          3421:                }
        !          3422:              else
        !          3423:                {
        !          3424:                  char buf[80];
        !          3425:                  char *msg;
        !          3426:                  tree seen = saw_private;
        !          3427: 
        !          3428:                  if (saw_private)
        !          3429:                    {
        !          3430:                      if (saw_protected)
        !          3431:                        msg = "%s `%%D' (and the like) are private or protected";
        !          3432:                      else
        !          3433:                        msg = "the %s `%%D' is private";
        !          3434:                    }
        !          3435:                  else
        !          3436:                    {
        !          3437:                      msg = "the %s `%%D' is protected";
        !          3438:                      seen = saw_protected;
        !          3439:                    }
        !          3440:                  sprintf (buf, msg, name_kind);
        !          3441:                  cp_error_at (buf, seen);
        !          3442:                  error ("within this context");
        !          3443:                }
        !          3444:              return error_mark_node;
        !          3445:            }
        !          3446: 
        !          3447:          if ((flags & (LOOKUP_SPECULATIVELY|LOOKUP_COMPLAIN))
        !          3448:              == LOOKUP_COMPLAIN)
        !          3449:            {
        !          3450:              if (TREE_CODE (save_basetype) == RECORD_TYPE)
        !          3451:                tag_name = "structure";
        !          3452:              else
        !          3453:                tag_name = "union";
        !          3454: 
        !          3455:              /* FIXME: is this doing the right thing? */
        !          3456:              buf = (char *)alloca (30 + strlen (err_name));
        !          3457:              strcpy (buf, "%s has no method named `%s'");
        !          3458:              error (buf, tag_name, err_name);
        !          3459:              return error_mark_node;
        !          3460:            }
        !          3461:          return NULL_TREE;
        !          3462:        }
        !          3463:       continue;
        !          3464: 
        !          3465:     found_and_maybe_warn:
        !          3466:       if ((flag_ansi_overloading
        !          3467:           && (cp->v.ansi_harshness[0].code & CONST_CODE))
        !          3468:          || (!flag_ansi_overloading
        !          3469:              && CONST_HARSHNESS (cp->v.old_harshness[0])))
        !          3470:        {
        !          3471:          if (flags & LOOKUP_COMPLAIN)
        !          3472:            {
        !          3473:              cp_error_at ("non-const member function `%D'", cp->function);
        !          3474:              error ("called for const object at this point in file");
        !          3475:            }
        !          3476:          /* Not good enough for a match.  */
        !          3477:          else
        !          3478:            return error_mark_node;
        !          3479:        }
        !          3480:       goto found_and_ok;
        !          3481:     }
        !          3482:   /* Silently return error_mark_node.  */
        !          3483:   return error_mark_node;
        !          3484: 
        !          3485:  found:
        !          3486:   if (visibility == visibility_private)
        !          3487:     {
        !          3488:       if (flags & LOOKUP_COMPLAIN)
        !          3489:        {
        !          3490:          error_with_file_and_line (DECL_SOURCE_FILE (function),
        !          3491:                                    DECL_SOURCE_LINE (function),
        !          3492:                                    TREE_PRIVATE (function)
        !          3493:                                    ? "%s `%s' is private"
        !          3494:                                    : "%s `%s' is from private base class",
        !          3495:                                    name_kind,
        !          3496:                                    lang_printable_name (function));
        !          3497:          error ("within this context");
        !          3498:        }
        !          3499:       return error_mark_node;
        !          3500:     }
        !          3501:   else if (visibility == visibility_protected)
        !          3502:     {
        !          3503:       if (flags & LOOKUP_COMPLAIN)
        !          3504:        {
        !          3505:          error_with_file_and_line (DECL_SOURCE_FILE (function),
        !          3506:                                    DECL_SOURCE_LINE (function),
        !          3507:                                    TREE_PROTECTED (function)
        !          3508:                                    ? "%s `%s' is protected"
        !          3509:                                    : "%s `%s' has protected visibility from this point",
        !          3510:                                    name_kind,
        !          3511:                                    lang_printable_name (function));
        !          3512:          error ("within this context");
        !          3513:        }
        !          3514:       return error_mark_node;
        !          3515:     }
        !          3516:   my_friendly_abort (1);
        !          3517: 
        !          3518:  found_and_ok:
        !          3519: 
        !          3520:   /* From here on down, BASETYPE is the type that INSTANCE_PTR's
        !          3521:      type (if it exists) is a pointer to.  */
        !          3522:   function = DECL_MAIN_VARIANT (function);
        !          3523:   /* Declare external function if necessary. */
        !          3524:   assemble_external (function);
        !          3525: 
        !          3526:   fntype = TREE_TYPE (function);
        !          3527:   if (TREE_CODE (fntype) == POINTER_TYPE)
        !          3528:     fntype = TREE_TYPE (fntype);
        !          3529:   basetype = DECL_CLASS_CONTEXT (function);
        !          3530: 
        !          3531:   /* If we are referencing a virtual function from an object
        !          3532:      of effectively static type, then there is no need
        !          3533:      to go through the virtual function table.  */
        !          3534:   if (need_vtbl == maybe_needed)
        !          3535:     {
        !          3536:       int fixed_type = resolves_to_fixed_type_p (instance, 0);
        !          3537: 
        !          3538:       if (all_virtual == 1
        !          3539:          && DECL_VINDEX (function)
        !          3540:          && may_be_remote (basetype))
        !          3541:        need_vtbl = needed;
        !          3542:       else if (DECL_VINDEX (function))
        !          3543:        need_vtbl = fixed_type ? unneeded : needed;
        !          3544:       else
        !          3545:        need_vtbl = not_needed;
        !          3546:     }
        !          3547: 
        !          3548:   if (TREE_CODE (fntype) == METHOD_TYPE && static_call_context
        !          3549:       && !DECL_CONSTRUCTOR_P (function))
        !          3550:     {
        !          3551:       /* Let's be nice to the user for now, and give reasonable
        !          3552:         default behavior.  */
        !          3553:       instance_ptr = current_class_decl;
        !          3554:       if (instance_ptr)
        !          3555:        {
        !          3556:          if (basetype != current_class_type)
        !          3557:            {
        !          3558:              tree binfo = get_binfo (basetype, current_class_type, 1);
        !          3559:              if (binfo == NULL_TREE)
        !          3560:                {
        !          3561:                  error_not_base_type (function, current_class_type);
        !          3562:                  return error_mark_node;
        !          3563:                }
        !          3564:              else if (basetype == error_mark_node)
        !          3565:                return error_mark_node;
        !          3566:            }
        !          3567:        }
        !          3568:       /* Only allow a static member function to call another static member
        !          3569:         function.  */
        !          3570:       else if (DECL_LANG_SPECIFIC (function)
        !          3571:               && !DECL_STATIC_FUNCTION_P (function))
        !          3572:        {
        !          3573:          cp_error ("cannot call member function `%T::%s' without object",
        !          3574:                      basetype, err_name);
        !          3575:          return error_mark_node;
        !          3576:        }
        !          3577:     }
        !          3578: 
        !          3579:   value_type = TREE_TYPE (fntype) ? TREE_TYPE (fntype) : void_type_node;
        !          3580: 
        !          3581:   if (TYPE_SIZE (value_type) == 0)
        !          3582:     {
        !          3583:       if (flags & LOOKUP_COMPLAIN)
        !          3584:        incomplete_type_error (0, value_type);
        !          3585:       return error_mark_node;
        !          3586:     }
        !          3587: 
        !          3588:   /* We do not pass FUNCTION into `convert_arguments', because by
        !          3589:      now everything should be ok.  If not, then we have a serious error.  */
        !          3590:   if (DECL_STATIC_FUNCTION_P (function))
        !          3591:     parms = convert_arguments (NULL_TREE, TYPE_ARG_TYPES (fntype),
        !          3592:                               TREE_CHAIN (parms), NULL_TREE, LOOKUP_NORMAL);
        !          3593:   else if (need_vtbl == unneeded)
        !          3594:     {
        !          3595:       int sub_flags = DECL_CONSTRUCTOR_P (function) ? flags : LOOKUP_NORMAL;
        !          3596:       basetype = TREE_TYPE (instance);
        !          3597:       if (TYPE_METHOD_BASETYPE (TREE_TYPE (function)) != TYPE_MAIN_VARIANT (basetype)
        !          3598:          && TYPE_USES_COMPLEX_INHERITANCE (basetype))
        !          3599:        {
        !          3600:          basetype = DECL_CLASS_CONTEXT (function);
        !          3601:          instance_ptr = convert_pointer_to (basetype, instance_ptr);
        !          3602:          instance = build_indirect_ref (instance_ptr, NULL_PTR);
        !          3603:        }
        !          3604:       parms = tree_cons (NULL_TREE, instance_ptr,
        !          3605:                         convert_arguments (NULL_TREE, TREE_CHAIN (TYPE_ARG_TYPES (fntype)), TREE_CHAIN (parms), NULL_TREE, sub_flags));
        !          3606:     }
        !          3607:   else
        !          3608:     {
        !          3609:       if ((flags & LOOKUP_NONVIRTUAL) == 0)
        !          3610:        basetype = DECL_CONTEXT (function);
        !          3611: 
        !          3612:       /* First parm could be integer_zerop with casts like
        !          3613:         ((Object*)0)->Object::IsA()  */
        !          3614:       if (!integer_zerop (TREE_VALUE (parms)))
        !          3615:        {
        !          3616:          /* Since we can't have inheritance with a union, doing get_binfo
        !          3617:             on it won't work.  We do all the convert_pointer_to_real
        !          3618:             stuff to handle MI correctly...for unions, that's not
        !          3619:             an issue, so we must short-circuit that extra work here.  */
        !          3620:          tree tmp = TREE_TYPE (TREE_TYPE (TREE_VALUE (parms)));
        !          3621:          if (tmp != NULL_TREE && TREE_CODE (tmp) == UNION_TYPE)
        !          3622:            instance_ptr = TREE_VALUE (parms);
        !          3623:          else
        !          3624:            {
        !          3625:              tree binfo = get_binfo (basetype,
        !          3626:                                      TREE_TYPE (TREE_TYPE (TREE_VALUE (parms))),
        !          3627:                                      0);
        !          3628:              instance_ptr = convert_pointer_to_real (binfo, TREE_VALUE (parms));
        !          3629:            }
        !          3630:          instance_ptr
        !          3631:            = convert_pointer_to (build_type_variant (basetype,
        !          3632:                                                      constp, volatilep),
        !          3633:                                  instance_ptr);
        !          3634: 
        !          3635:          if (TREE_CODE (instance_ptr) == COND_EXPR)
        !          3636:            {
        !          3637:              instance_ptr = save_expr (instance_ptr);
        !          3638:              instance = build_indirect_ref (instance_ptr, NULL_PTR);
        !          3639:            }
        !          3640:          else if (TREE_CODE (instance_ptr) == NOP_EXPR
        !          3641:                   && TREE_CODE (TREE_OPERAND (instance_ptr, 0)) == ADDR_EXPR
        !          3642:                   && TREE_OPERAND (TREE_OPERAND (instance_ptr, 0), 0) == instance)
        !          3643:            ;
        !          3644:          /* The call to `convert_pointer_to' may return error_mark_node.  */
        !          3645:          else if (TREE_CODE (instance_ptr) == ERROR_MARK)
        !          3646:            return instance_ptr;
        !          3647:          else if (instance == NULL_TREE
        !          3648:                   || TREE_CODE (instance) != INDIRECT_REF
        !          3649:                   || TREE_OPERAND (instance, 0) != instance_ptr)
        !          3650:            instance = build_indirect_ref (instance_ptr, NULL_PTR);
        !          3651:        }
        !          3652:       parms = tree_cons (NULL_TREE, instance_ptr,
        !          3653:                         convert_arguments (NULL_TREE, TREE_CHAIN (TYPE_ARG_TYPES (fntype)), TREE_CHAIN (parms), NULL_TREE, LOOKUP_NORMAL));
        !          3654:     }
        !          3655: 
        !          3656: #if 0
        !          3657:   /* Constructors do not overload method calls.  */
        !          3658:   else if (TYPE_OVERLOADS_METHOD_CALL_EXPR (basetype)
        !          3659:           && name != TYPE_IDENTIFIER (basetype)
        !          3660:           && (TREE_CODE (function) != FUNCTION_DECL
        !          3661:               || strncmp (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (function)),
        !          3662:                           OPERATOR_METHOD_FORMAT,
        !          3663:                           OPERATOR_METHOD_LENGTH))
        !          3664:           && (may_be_remote (basetype) || instance != C_C_D))
        !          3665:     {
        !          3666:       tree fn_as_int;
        !          3667: 
        !          3668:       parms = TREE_CHAIN (parms);
        !          3669: 
        !          3670:       if (!all_virtual && TREE_CODE (function) == FUNCTION_DECL)
        !          3671:        fn_as_int = build_unary_op (ADDR_EXPR, function, 0);
        !          3672:       else
        !          3673:        fn_as_int = convert (TREE_TYPE (default_conversion (function)), DECL_VINDEX (function));
        !          3674:       if (all_virtual == 1)
        !          3675:        fn_as_int = convert (integer_type_node, fn_as_int);
        !          3676: 
        !          3677:       result = build_opfncall (METHOD_CALL_EXPR, LOOKUP_NORMAL, instance, fn_as_int, parms);
        !          3678: 
        !          3679:       if (result == NULL_TREE)
        !          3680:        {
        !          3681:          compiler_error ("could not overload `operator->()(...)'");
        !          3682:          return error_mark_node;
        !          3683:        }
        !          3684:       else if (result == error_mark_node)
        !          3685:        return error_mark_node;
        !          3686: 
        !          3687: #if 0
        !          3688:       /* Do this if we want the result of operator->() to inherit
        !          3689:         the type of the function it is subbing for.  */
        !          3690:       TREE_TYPE (result) = value_type;
        !          3691: #endif
        !          3692: 
        !          3693:       return result;
        !          3694:     }
        !          3695: #endif
        !          3696: 
        !          3697:   if (need_vtbl == needed)
        !          3698:     {
        !          3699:       function = build_vfn_ref (&TREE_VALUE (parms), instance, DECL_VINDEX (function));
        !          3700:       TREE_TYPE (function) = build_pointer_type (fntype);
        !          3701:     }
        !          3702: 
        !          3703:   if (TREE_CODE (function) == FUNCTION_DECL)
        !          3704:     GNU_xref_call (current_function_decl,
        !          3705:                   IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (function)));
        !          3706: 
        !          3707:   if (TREE_CODE (function) == FUNCTION_DECL)
        !          3708:     {
        !          3709:       if (DECL_INLINE (function))
        !          3710:        function = build1 (ADDR_EXPR, build_pointer_type (fntype), function);
        !          3711:       else
        !          3712:        {
        !          3713:          assemble_external (function);
        !          3714:          TREE_USED (function) = 1;
        !          3715:          function = default_conversion (function);
        !          3716:        }
        !          3717:     }
        !          3718:   else
        !          3719:     function = default_conversion (function);
        !          3720: 
        !          3721:   result = build_nt (CALL_EXPR, function, parms, NULL_TREE);
        !          3722: 
        !          3723:   TREE_TYPE (result) = value_type;
        !          3724:   TREE_SIDE_EFFECTS (result) = 1;
        !          3725:   TREE_RAISES (result)
        !          3726:     = TYPE_RAISES_EXCEPTIONS (fntype) || (parms && TREE_RAISES (parms));
        !          3727:   return result;
        !          3728: }
        !          3729: 
        !          3730: /* Similar to `build_method_call', but for overloaded non-member functions.
        !          3731:    The name of this function comes through NAME.  The name depends
        !          3732:    on PARMS.
        !          3733: 
        !          3734:    Note that this function must handle simple `C' promotions,
        !          3735:    as well as variable numbers of arguments (...), and
        !          3736:    default arguments to boot.
        !          3737: 
        !          3738:    If the overloading is successful, we return a tree node which
        !          3739:    contains the call to the function.
        !          3740: 
        !          3741:    If overloading produces candidates which are probable, but not definite,
        !          3742:    we hold these candidates.  If FINAL_CP is non-zero, then we are free
        !          3743:    to assume that final_cp points to enough storage for all candidates that
        !          3744:    this function might generate.  The `harshness' array is preallocated for
        !          3745:    the first candidate, but not for subsequent ones.
        !          3746: 
        !          3747:    Note that the DECL_RTL of FUNCTION must be made to agree with this
        !          3748:    function's new name.  */
        !          3749: 
        !          3750: tree
        !          3751: build_overload_call_real (fnname, parms, complain, final_cp, buildxxx)
        !          3752:      tree fnname, parms;
        !          3753:      int complain;
        !          3754:      struct candidate *final_cp;
        !          3755:      int buildxxx;
        !          3756: {
        !          3757:   /* must check for overloading here */
        !          3758:   tree overload_name, functions, function, parm;
        !          3759:   tree parmtypes = NULL_TREE, last = NULL_TREE;
        !          3760:   register tree outer;
        !          3761:   int length;
        !          3762:   int parmlength = list_length (parms);
        !          3763: 
        !          3764:   struct candidate *candidates, *cp;
        !          3765: 
        !          3766:   if (final_cp)
        !          3767:     {
        !          3768:       if (flag_ansi_overloading)
        !          3769:        {
        !          3770:          final_cp[0].h.code = 0;
        !          3771:          final_cp[0].h.distance = 0;
        !          3772:          final_cp[0].function = 0;
        !          3773:          /* end marker.  */
        !          3774:          final_cp[1].h.code = EVIL_CODE;
        !          3775:        }
        !          3776:       else
        !          3777:        {
        !          3778:          final_cp[0].evil = 0;
        !          3779:          final_cp[0].user = 0;
        !          3780:          final_cp[0].b_or_d = 0;
        !          3781:          final_cp[0].easy = 0;
        !          3782:          final_cp[0].function = 0;
        !          3783:          /* end marker.  */
        !          3784:          final_cp[1].evil = 1;
        !          3785:        }
        !          3786:     }
        !          3787: 
        !          3788:   for (parm = parms; parm; parm = TREE_CHAIN (parm))
        !          3789:     {
        !          3790:       register tree t = TREE_TYPE (TREE_VALUE (parm));
        !          3791: 
        !          3792:       if (t == error_mark_node)
        !          3793:        {
        !          3794:          if (final_cp)
        !          3795:            {
        !          3796:              if (flag_ansi_overloading)
        !          3797:                final_cp->h.code = EVIL_CODE;
        !          3798:              else
        !          3799:                final_cp->evil = 1;
        !          3800:            }
        !          3801:          return error_mark_node;
        !          3802:        }
        !          3803:       if (TREE_CODE (t) == ARRAY_TYPE || TREE_CODE (t) == OFFSET_TYPE)
        !          3804:        {
        !          3805:          /* Perform the conversion from ARRAY_TYPE to POINTER_TYPE in place.
        !          3806:             Also convert OFFSET_TYPE entities to their normal selves.
        !          3807:             This eliminates needless calls to `compute_conversion_costs'.  */
        !          3808:          TREE_VALUE (parm) = default_conversion (TREE_VALUE (parm));
        !          3809:          t = TREE_TYPE (TREE_VALUE (parm));
        !          3810:        }
        !          3811:       last = build_tree_list (NULL_TREE, t);
        !          3812:       parmtypes = chainon (parmtypes, last);
        !          3813:     }
        !          3814:   if (last)
        !          3815:     TREE_CHAIN (last) = void_list_node;
        !          3816:   else
        !          3817:     parmtypes = void_list_node;
        !          3818: 
        !          3819:   if (! flag_ansi_overloading)
        !          3820:     {
        !          3821:       /* This is a speed improvement that ends up not working properly in
        !          3822:         the situation of fns with and without default parameters.  I turned
        !          3823:         this off in the new method so it'll go through the argument matching
        !          3824:         code to properly diagnose a match/failure. (bpk)  */
        !          3825:       overload_name = build_decl_overload (fnname, parmtypes, 0);
        !          3826: 
        !          3827:       /* Now check to see whether or not we can win.
        !          3828:         Note that if we are called from `build_method_call',
        !          3829:         then we cannot have a mis-match, because we would have
        !          3830:         already found such a winning case.  */
        !          3831: 
        !          3832:       if (IDENTIFIER_GLOBAL_VALUE (overload_name))
        !          3833:        if (TREE_CODE (IDENTIFIER_GLOBAL_VALUE (overload_name)) != TREE_LIST)
        !          3834:          return build_function_call (DECL_MAIN_VARIANT (IDENTIFIER_GLOBAL_VALUE (overload_name)), parms);
        !          3835:     }
        !          3836: 
        !          3837:   functions = IDENTIFIER_GLOBAL_VALUE (fnname);
        !          3838: 
        !          3839:   if (functions == NULL_TREE)
        !          3840:     {
        !          3841:       if (complain)
        !          3842:        error ("only member functions apply");
        !          3843:       if (final_cp)
        !          3844:        {
        !          3845:          if (flag_ansi_overloading)
        !          3846:            final_cp->h.code = EVIL_CODE;
        !          3847:          else
        !          3848:            final_cp->evil = 1;
        !          3849:        }
        !          3850:       return error_mark_node;
        !          3851:     }
        !          3852: 
        !          3853:   if (TREE_CODE (functions) == FUNCTION_DECL)
        !          3854:     {
        !          3855:       functions = DECL_MAIN_VARIANT (functions);
        !          3856:       if (final_cp)
        !          3857:        {
        !          3858:          /* We are just curious whether this is a viable alternative or not.  */
        !          3859:          compute_conversion_costs (functions, parms, final_cp, parmlength);
        !          3860:          return functions;
        !          3861:        }
        !          3862:       else
        !          3863:        return build_function_call (functions, parms);
        !          3864:     }
        !          3865: 
        !          3866:   if (TREE_VALUE (functions) == NULL_TREE)
        !          3867:     {
        !          3868:       if (complain)
        !          3869:        cp_error ("function `%D' declared overloaded, but no instances of that function declared",
        !          3870:                  TREE_PURPOSE (functions));
        !          3871:       if (final_cp)
        !          3872:        {
        !          3873:          if (flag_ansi_overloading)
        !          3874:            final_cp->h.code = EVIL_CODE;
        !          3875:          else
        !          3876:            final_cp->evil = 1;
        !          3877:        }
        !          3878:       return error_mark_node;
        !          3879:     }
        !          3880: 
        !          3881:   if (TREE_CODE (TREE_VALUE (functions)) == TREE_LIST)
        !          3882:     {
        !          3883:       register tree outer;
        !          3884:       length = 0;
        !          3885: 
        !          3886:       /* The list-of-lists should only occur for class things.  */
        !          3887:       my_friendly_assert (functions == IDENTIFIER_CLASS_VALUE (fnname), 168);
        !          3888: 
        !          3889:       for (outer = functions; outer; outer = TREE_CHAIN (outer))
        !          3890:        {
        !          3891:          /* member functions.  */
        !          3892:          length += decl_list_length (TREE_VALUE (TREE_VALUE (outer)));
        !          3893:          /* friend functions.  */
        !          3894:          length += list_length (TREE_TYPE (TREE_VALUE (outer)));
        !          3895:        }
        !          3896:     }
        !          3897:   else
        !          3898:     length = list_length (functions);
        !          3899: 
        !          3900:   if (final_cp)
        !          3901:     candidates = final_cp;
        !          3902:   else
        !          3903:     {
        !          3904:       candidates
        !          3905:        = (struct candidate *)alloca ((length+1) * sizeof (struct candidate));
        !          3906:       bzero (candidates, (length + 1) * sizeof (struct candidate));
        !          3907:     }
        !          3908: 
        !          3909:   cp = candidates;
        !          3910: 
        !          3911:   my_friendly_assert (TREE_CODE (TREE_VALUE (functions)) != TREE_LIST, 169);
        !          3912: 
        !          3913:   /* OUTER is the list of FUNCTION_DECLS, in a TREE_LIST.  */
        !          3914:   for (outer = functions; outer; outer = TREE_CHAIN (outer))
        !          3915:     {
        !          3916:       int template_cost = 0;
        !          3917:       function = TREE_VALUE (outer);
        !          3918:       if (TREE_CODE (function) != FUNCTION_DECL
        !          3919:          && ! (TREE_CODE (function) == TEMPLATE_DECL
        !          3920:                && ! DECL_TEMPLATE_IS_CLASS (function)
        !          3921:                && TREE_CODE (DECL_TEMPLATE_RESULT (function)) == FUNCTION_DECL))
        !          3922:        {
        !          3923:          enum tree_code code = TREE_CODE (function);
        !          3924:          if (code == TEMPLATE_DECL)
        !          3925:            code = TREE_CODE (DECL_TEMPLATE_RESULT (function));
        !          3926:          if (code == CONST_DECL)
        !          3927:            cp_error_at
        !          3928:              ("enumeral value `%D' conflicts with function of same name",
        !          3929:               function);
        !          3930:          else if (code == VAR_DECL)
        !          3931:            {
        !          3932:              if (TREE_STATIC (function))
        !          3933:                cp_error_at
        !          3934:                  ("variable `%D' conflicts with function of same name",
        !          3935:                   function);
        !          3936:              else
        !          3937:                cp_error_at
        !          3938:                  ("constant field `%D' conflicts with function of same name",
        !          3939:                   function);
        !          3940:            }
        !          3941:          else if (code == TYPE_DECL)
        !          3942:            continue;
        !          3943:          else
        !          3944:            my_friendly_abort (2);
        !          3945:          error ("at this point in file");
        !          3946:          continue;
        !          3947:        }
        !          3948:       if (TREE_CODE (function) == TEMPLATE_DECL)
        !          3949:        {
        !          3950:          int ntparms = TREE_VEC_LENGTH (DECL_TEMPLATE_PARMS (function));
        !          3951:          tree *targs = (tree *) alloca (sizeof (tree) * ntparms);
        !          3952:          int i;
        !          3953: 
        !          3954:          i = type_unification (DECL_TEMPLATE_PARMS (function), targs,
        !          3955:                                TYPE_ARG_TYPES (TREE_TYPE (function)),
        !          3956:                                parms, &template_cost);
        !          3957:          if (i == 0)
        !          3958:            {
        !          3959:              struct candidate *cp2;
        !          3960: 
        !          3961:              function = instantiate_template (function, targs);
        !          3962:              /* Now check that the template instantiated for this is not
        !          3963:                 the same as a function that's in the list due to some
        !          3964:                 previous instantiation.  */
        !          3965:              cp2 = candidates;
        !          3966:              while (cp2 != cp)
        !          3967:                if (cp2->function == function)
        !          3968:                  break;
        !          3969:                else
        !          3970:                  cp2 += 1;
        !          3971:              if (cp2->function == function)
        !          3972:                continue;
        !          3973:            }
        !          3974:        }
        !          3975: 
        !          3976:       if (TREE_CODE (function) == TEMPLATE_DECL)
        !          3977:        {
        !          3978:          /* Unconverted template -- failed match.  */
        !          3979:          cp->function = function;
        !          3980:          cp->u.bad_arg = -4;
        !          3981:          if (flag_ansi_overloading)
        !          3982:            cp->h.code = EVIL_CODE;
        !          3983:          else
        !          3984:            cp->evil = 1;
        !          3985:        }
        !          3986:       else
        !          3987:        {
        !          3988:          function = DECL_MAIN_VARIANT (function);
        !          3989: 
        !          3990:          /* Can't use alloca here, since result might be
        !          3991:             passed to calling function.  */
        !          3992:          if (flag_ansi_overloading)
        !          3993:            {
        !          3994:              cp->v.ansi_harshness
        !          3995:                = (struct harshness_code *)oballoc ((parmlength+1) * sizeof (struct harshness_code));
        !          3996:              cp->h_len = parmlength;
        !          3997:            }
        !          3998:          else
        !          3999:            cp->v.old_harshness
        !          4000:              = (unsigned short *)oballoc ((parmlength+1) * sizeof (short));
        !          4001: 
        !          4002:          compute_conversion_costs (function, parms, cp, parmlength);
        !          4003: 
        !          4004:          if (flag_ansi_overloading)
        !          4005:            /* Make sure this is clear as well.  */
        !          4006:            cp->h.int_penalty += template_cost;
        !          4007:          else
        !          4008:            /* Should really add another field...  */
        !          4009:            cp->easy = cp->easy * 128 + template_cost;
        !          4010: 
        !          4011:          /* It seemed easier to have both if stmts in here, rather
        !          4012:             than excluding the hell out of it with flag_ansi_overloading
        !          4013:             everywhere. (bpk) */
        !          4014:          if (flag_ansi_overloading)
        !          4015:            {
        !          4016:              if ((cp[0].h.code & EVIL_CODE) == 0)
        !          4017:                {
        !          4018:                  cp[1].h.code = EVIL_CODE;
        !          4019: 
        !          4020:                  /* int_penalty is set by convert_harshness_ansi for cases
        !          4021:                     where we need to know about any penalties that would
        !          4022:                     otherwise make a TRIVIAL_CODE pass.  */
        !          4023:                  if (final_cp
        !          4024:                      && template_cost == 0
        !          4025:                      && cp[0].h.code <= TRIVIAL_CODE
        !          4026:                      && cp[0].h.int_penalty == 0)
        !          4027:                    {
        !          4028:                      final_cp[0].h = cp[0].h;
        !          4029:                      return function;
        !          4030:                    }
        !          4031:                  cp++;
        !          4032:                }
        !          4033:            }
        !          4034:          else
        !          4035:            {
        !          4036:              if (cp[0].evil == 0)
        !          4037:                {
        !          4038:                  cp[1].evil = 1;
        !          4039:                  if (final_cp
        !          4040:                      && cp[0].user == 0 && cp[0].b_or_d == 0
        !          4041:                      && template_cost == 0
        !          4042:                      && cp[0].easy <= 1)
        !          4043:                    {
        !          4044:                      final_cp[0].easy = cp[0].easy;
        !          4045:                      return function;
        !          4046:                    }
        !          4047:                  cp++;
        !          4048:                }
        !          4049:            }
        !          4050:        }
        !          4051:     }
        !          4052: 
        !          4053:   if (cp - candidates)
        !          4054:     {
        !          4055:       tree rval = error_mark_node;
        !          4056: 
        !          4057:       /* Leave marker.  */
        !          4058:       if (flag_ansi_overloading)
        !          4059:        cp[0].h.code = EVIL_CODE;
        !          4060:       else
        !          4061:        cp[0].evil = 1;
        !          4062:       if (cp - candidates > 1)
        !          4063:        {
        !          4064:          struct candidate *best_cp
        !          4065:            = ideal_candidate (NULL_TREE, candidates,
        !          4066:                               cp - candidates, parms, parmlength);
        !          4067:          if (best_cp == (struct candidate *)0)
        !          4068:            {
        !          4069:              if (complain)
        !          4070:                cp_error ("call of overloaded `%D' is ambiguous", fnname);
        !          4071:              return error_mark_node;
        !          4072:            }
        !          4073:          else
        !          4074:            rval = best_cp->function;
        !          4075:        }
        !          4076:       else
        !          4077:        {
        !          4078:          cp -= 1;
        !          4079:          if ((flag_ansi_overloading && (cp->h.code & EVIL_CODE))
        !          4080:              || (!flag_ansi_overloading && cp->evil > 1))
        !          4081:            {
        !          4082:              if (complain)
        !          4083:                error ("type conversion ambiguous");
        !          4084:            }
        !          4085:          else
        !          4086:            rval = cp->function;
        !          4087:        }
        !          4088: 
        !          4089:       if (final_cp)
        !          4090:        return rval;
        !          4091: 
        !          4092:       return buildxxx ? build_function_call_maybe (rval, parms)
        !          4093:         : build_function_call (rval, parms);
        !          4094:     }
        !          4095:   else if (complain)
        !          4096:     report_type_mismatch (cp, parms, "function",
        !          4097:                          decl_as_string (cp->function, 1));
        !          4098: 
        !          4099:   return error_mark_node;
        !          4100: }
        !          4101: 
        !          4102: tree
        !          4103: build_overload_call (fnname, parms, complain, final_cp)
        !          4104:      tree fnname, parms;
        !          4105:      int complain;
        !          4106:      struct candidate *final_cp;
        !          4107: {
        !          4108:   return build_overload_call_real (fnname, parms, complain, final_cp, 0);
        !          4109: }
        !          4110: 
        !          4111: tree
        !          4112: build_overload_call_maybe (fnname, parms, complain, final_cp)
        !          4113:      tree fnname, parms;
        !          4114:      int complain;
        !          4115:      struct candidate *final_cp;
        !          4116: {
        !          4117:   return build_overload_call_real (fnname, parms, complain, final_cp, 1);
        !          4118: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.