Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changeset 789

Show
Ignore:
Timestamp:
12/06/10 20:21:32 (14 years ago)
Author:
walter
Message:

bugzilla 2954 [tdpl] Appalling bug in associative arrays (D2 only)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/expression.c

    r787 r789  
    85888588            // Do compile time array bounds checking if possible 
    85898589            e2 = e2->optimize(WANTvalue); 
    85908590            if (e2->op == TOKint64) 
    85918591            { 
    85928592                dinteger_t index = e2->toInteger(); 
    85938593                dinteger_t length = tsa->dim->toInteger(); 
    85948594                if (index < 0 || index >= length) 
    85958595                    error("array index [%lld] is outside array bounds [0 .. %lld]", 
    85968596                            index, length); 
    85978597            } 
    85988598#endif 
    85998599            e->type = t1->nextOf(); 
    86008600            break; 
    86018601        } 
    86028602 
    86038603        case Taarray: 
    86048604        {   TypeAArray *taa = (TypeAArray *)t1; 
    86058605            /* We can skip the implicit conversion if they differ only by 
    86068606             * constness (Bugzilla 2684, see also bug 2954b) 
    86078607             */ 
    8608             if (!arrayTypeCompatible(e2->loc, e2->type, taa->index)) 
     8608            if (!arrayTypeCompatibleWithoutCasting(e2->loc, e2->type, taa->index)) 
    86098609            { 
    86108610                e2 = e2->implicitCastTo(sc, taa->index);        // type checking 
    86118611            } 
    86128612            type = taa->next; 
    86138613            break; 
    86148614        } 
    86158615 
    86168616        case Ttuple: 
    86178617        { 
    86188618            e2 = e2->implicitCastTo(sc, Type::tsize_t); 
    86198619            e2 = e2->optimize(WANTvalue | WANTinterpret); 
    86208620            uinteger_t index = e2->toUInteger(); 
    86218621            size_t length; 
    86228622            TupleExp *te; 
    86238623            TypeTuple *tup; 
    86248624 
    86258625            if (e1->op == TOKtuple) 
    86268626            {   te = (TupleExp *)e1; 
    86278627                length = te->exps->dim; 
    86288628            }