Changeset 659

Show
Ignore:
Timestamp:
07/02/07 18:20:06 (1 year ago)
Author:
Gregor
Message:

MERGE: DMD 1.018

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/dmdfe/attrib.c

    r458 r659  
    10761076    Parser p(sc->module, (unsigned char *)se->string, se->len, 0); 
    10771077    p.loc = loc; 
     1078    p.nextToken(); 
    10781079    decl = p.parseDeclDefs(0); 
    10791080    if (p.token.value != TOKeof) 
  • branches/dmdfe/class.c

    r458 r659  
    524524    structalign = 0; 
    525525 
    526     sc->pop(); 
     526    sc = sc->pop(); 
    527527 
    528528    scope = scx ? scx : new Scope(*sc); 
  • branches/dmdfe/dsymbol.c

    r458 r659  
    871871        v->storage_class |= STCconst; 
    872872        } 
     873        else if (ce->op == TOKarrayliteral) 
     874        {   /* It is for an array literal, so the 
     875         * length will be a const. 
     876         */ 
     877        Expression *e = new IntegerExp(0, ((ArrayLiteralExp *)ce)->elements->dim, Type::tsize_t); 
     878        v->init = new ExpInitializer(0, e); 
     879        v->storage_class |= STCconst; 
     880        } 
    873881        else if (ce->op == TOKtuple) 
    874882        {   /* It is for an expression tuple, so the 
  • branches/dmdfe/expression.c

    r658 r659  
    303303void expandTuples(Expressions *exps) 
    304304{ 
     305    //printf("expandTuples()\n"); 
    305306    if (exps) 
    306307    { 
     
    309310        if (!arg) 
    310311        continue; 
     312 
     313        // Look for tuple with 0 members 
     314        if (arg->op == TOKtype) 
     315        {   TypeExp *e = (TypeExp *)arg; 
     316        if (e->type->toBasetype()->ty == Ttuple) 
     317        {   TypeTuple *tt = (TypeTuple *)e->type->toBasetype(); 
     318 
     319            if (!tt->arguments || tt->arguments->dim == 0) 
     320            { 
     321            exps->remove(i); 
     322            if (i == exps->dim) 
     323                return; 
     324            i--; 
     325            continue; 
     326            } 
     327        } 
     328        } 
    311329 
    312330        // Inline expand all the tuples 
     
    665683    Expression *e; 
    666684    if (!size) 
     685    { 
     686#ifdef DEBUG 
    667687    fprintf(stdmsg, "No expression copy for: %s\n", toChars()); 
     688    printf("op = %d\n", op); 
     689    dump(0); 
     690#endif 
     691    assert(0); 
     692    } 
    668693    e = (Expression *)mem.malloc(size); 
    669694    return (Expression *)memcpy(e, this, size); 
     
    858883{ 
    859884    if (flag == 0) 
    860     error("%s has no effect in expression (%s)", 
     885    {   if (op == TOKimport) 
     886    { 
     887        error("%s has no effect", toChars()); 
     888    } 
     889    else 
     890        error("%s has no effect in expression (%s)", 
    861891        Token::toChars(op), toChars()); 
     892    } 
    862893    return 0; 
    863894} 
     
    10091040char *IntegerExp::toChars() 
    10101041{ 
     1042#if 1 
     1043    return Expression::toChars(); 
     1044#else 
    10111045    static char buffer[sizeof(value) * 3 + 1]; 
    10121046 
    10131047    sprintf(buffer, "%jd", value); 
    10141048    return buffer; 
     1049#endif 
    10151050} 
    10161051 
     
    24352470} 
    24362471 
     2472ArrayLiteralExp::ArrayLiteralExp(Loc loc, Expression *e) 
     2473    : Expression(loc, TOKarrayliteral, sizeof(ArrayLiteralExp)) 
     2474{ 
     2475    elements = new Expressions; 
     2476    elements->push(e); 
     2477} 
     2478 
    24372479Expression *ArrayLiteralExp::syntaxCopy() 
    24382480{ 
     
    26662708    this->sd = sd; 
    26672709    this->elements = elements; 
    2668     this->s = NULL; 
     2710    this->sym = NULL; 
    26692711    this->soffset = 0; 
    26702712    this->fillHoles = 1; 
     
    43974439    Parser p(sc->module, (unsigned char *)se->string, se->len, 0); 
    43984440    p.loc = loc; 
     4441    p.nextToken(); 
    43994442    Expression *e = p.parseExpression(); 
    44004443    if (p.token.value != TOKeof) 
     
    47654808        assert(0); 
    47664809    } 
     4810    else if (ident == Id::stringof) 
     4811    {   char *s = ie->toChars(); 
     4812        e = new StringExp(loc, s, strlen(s), 'c'); 
     4813        e = e->semantic(sc); 
     4814        return e; 
     4815    } 
    47674816    error("undefined identifier %s", toChars()); 
    47684817    type = Type::tvoid; 
     
    53605409        e1 = e1->semantic(sc); 
    53615410    } 
     5411#if 1   // patch for #540 by Oskar Linde 
     5412    else if (e1->op == TOKdotexp) 
     5413    { 
     5414        DotExp *de = (DotExp *) e1; 
     5415 
     5416        if (de->e2->op == TOKimport) 
     5417        {   // This should *really* be moved to ScopeExp::semantic() 
     5418        ScopeExp *se = (ScopeExp *)de->e2; 
     5419        de->e2 = new DsymbolExp(loc, se->sds); 
     5420        de->e2 = de->e2->semantic(sc); 
     5421        } 
     5422 
     5423        if (de->e2->op == TOKtemplate) 
     5424        {   TemplateExp *te = (TemplateExp *) de->e2; 
     5425        e1 = new DotTemplateExp(loc,de->e1,te->td); 
     5426        } 
     5427    } 
     5428#endif 
    53625429    } 
    53635430 
     
    71637230    else 
    71647231    { 
    7165     error("Can only append to dynamic arrays, not %s ~= %s", tb1->toChars(), tb2->toChars()); 
     7232    error("cannot append type %s to type %s", tb2->toChars(), tb1->toChars()); 
    71667233    type = Type::tint32; 
    71677234    e = this; 
     
    75907657{   Expression *e; 
    75917658 
    7592     //printf("CatExp::semantic()\n"); 
     7659    //printf("CatExp::semantic() %s\n", toChars()); 
    75937660    if (!type) 
    75947661    { 
     
    76167683    { 
    76177684        type = tb1->next->arrayOf(); 
     7685        if (tb2->ty == Tarray) 
     7686        {   // Make e2 into [e2] 
     7687        e2 = new ArrayLiteralExp(e2->loc, e2); 
     7688        e2->type = type; 
     7689        } 
    76187690        return this; 
    76197691    } 
     
    76227694    { 
    76237695        type = tb2->next->arrayOf(); 
     7696        if (tb1->ty == Tarray) 
     7697        {   // Make e1 into [e1] 
     7698        e1 = new ArrayLiteralExp(e1->loc, e1); 
     7699        e1->type = type; 
     7700        } 
    76247701        return this; 
    76257702    } 
     
    83758452    unsigned cs1; 
    83768453 
     8454#if LOGSEMANTIC 
     8455    printf("CondExp::semantic('%s')\n", toChars()); 
     8456#endif 
    83778457    if (type) 
    83788458    return this; 
     
    84278507    { 
    84288508    typeCombine(sc); 
     8509    switch (e1->type->toBasetype()->ty) 
     8510    { 
     8511        case Tcomplex32: 
     8512        case Tcomplex64: 
     8513        case Tcomplex80: 
     8514        e2 = e2->castTo(sc, e1->type); 
     8515        break; 
     8516    } 
     8517    switch (e2->type->toBasetype()->ty) 
     8518    { 
     8519        case Tcomplex32: 
     8520        case Tcomplex64: 
     8521        case Tcomplex80: 
     8522        e1 = e1->castTo(sc, e2->type); 
     8523        break; 
     8524    } 
    84298525    } 
    84308526    return this; 
  • branches/dmdfe/expression.h

    r658 r659  
    334334 
    335335    ArrayLiteralExp(Loc loc, Expressions *elements); 
     336    ArrayLiteralExp(Loc loc, Expression *e); 
    336337 
    337338    Expression *syntaxCopy(); 
     
    384385                // NULL entries for fields to skip 
    385386 
    386     Symbol *s;        // back end symbol to initialize with literal 
     387    Symbol *sym;      // back end symbol to initialize with literal 
    387388    size_t soffset;     // offset from start of s 
    388389    int fillHoles;      // fill alignment 'holes' with zero 
     
    517518    int equals(Object *o); 
    518519    Expression *semantic(Scope *sc); 
     520    Expression *optimize(int result); 
    519521    Expression *interpret(InterState *istate); 
    520522    void dump(int indent); 
  • branches/dmdfe/func.c

    r458 r659  
    334334 
    335335    // This is an 'introducing' function. 
     336 
     337    // Verify this doesn't override previous final function 
     338    if (cd->baseClass) 
     339    {   Dsymbol *s = cd->baseClass->search(loc, ident, 0); 
     340        if (s) 
     341        { 
     342        FuncDeclaration *f = s->isFuncDeclaration(); 
     343        f = f->overloadExactMatch(type); 
     344        if (f && f->isFinal() && f->prot() != PROTprivate) 
     345            error("cannot override final function %s", f->toPrettyChars()); 
     346        } 
     347    } 
     348 
    336349    if (isFinal()) 
    337350    { 
    338         // Verify this doesn't override previous final function 
    339         if (cd->baseClass) 
    340         {   Dsymbol *s = cd->baseClass->search(loc, ident, 0); 
    341         if (s) 
    342         { 
    343             FuncDeclaration *f = s->isFuncDeclaration(); 
    344             f = f->overloadExactMatch(type); 
    345             if (f && f->isFinal()) 
    346             error("cannot override final function %s", f->toPrettyChars()); 
    347         } 
    348         } 
    349351        cd->vtblFinal.push(this); 
    350352    } 
     
    605607    sc2->incontract = 0; 
    606608    sc2->tf = NULL; 
     609    sc2->noctor = 0; 
    607610 
    608611    // Declare 'this' 
  • branches/dmdfe/inline.c

    r658 r659  
    823823{ 
    824824    condition = condition->inlineScan(iss); 
    825     body = body->inlineScan(iss)
     825    body = body ? body->inlineScan(iss) : NULL
    826826    return this; 
    827827} 
     
    830830Statement *DoStatement::inlineScan(InlineScanState *iss) 
    831831{ 
    832     body = body->inlineScan(iss)
     832    body = body ? body->inlineScan(iss) : NULL
    833833    condition = condition->inlineScan(iss); 
    834834    return this; 
     
    872872    //printf("SwitchStatement::inlineScan()\n"); 
    873873    condition = condition->inlineScan(iss); 
    874     body = body->inlineScan(iss)
     874    body = body ? body->inlineScan(iss) : NULL
    875875    if (sdefault) 
    876876    sdefault = (DefaultStatement *)sdefault->inlineScan(iss); 
  • branches/dmdfe/interpret.c

    r658 r659  
    11361136        {   expsx = new Expressions(); 
    11371137            expsx->setDim(elements->dim); 
    1138             for (size_t j = 0; j < i; j++) 
     1138            for (size_t j = 0; j < elements->dim; j++) 
    11391139            { 
    11401140            expsx->data[j] = elements->data[j]; 
     
    19421942    else 
    19431943        error("%s failed", toChars()); 
     1944    goto Lcant; 
    19441945    } 
    19451946    else 
  • branches/dmdfe/lexer.c

    r658 r659  
    401401    //printf("peekPastParen()\n"); 
    402402    int parens = 1; 
     403    int curlynest = 0; 
    403404    while (1) 
    404405    { 
     
    416417            continue; 
    417418        tk = peek(tk); 
     419        break; 
     420 
     421        case TOKlcurly: 
     422        curlynest++; 
     423        continue; 
     424 
     425        case TOKrcurly: 
     426        if (--curlynest >= 0) 
     427            continue; 
     428        break; 
     429 
     430        case TOKsemicolon: 
     431        if (curlynest) 
     432            continue; 
    418433        break; 
    419434 
  • branches/dmdfe/mars.c

    r658 r659  
    5656    copyright = "Copyright (c) 1999-2007 by Digital Mars"; 
    5757    written = "written by Walter Bright"; 
    58     version = "v1.017"; 
     58    version = "v1.018"; 
    5959    global.structalign = 8; 
    6060 
  • branches/dmdfe/mars.h

    r458 r659  
    3030#endif 
    3131 
    32 #define BREAKABI 1  // not ready to break the ABI just yet 
     32#define V2  0   // Version 2.0 features 
     33#define BREAKABI 1  // 0 if not ready to break the ABI just yet 
    3334 
    3435struct Array; 
  • branches/dmdfe/module.c

    r458 r659  
    578578    } 
    579579    Parser p(this, buf, buflen, docfile != NULL); 
     580    p.nextToken(); 
    580581    members = p.parseModule(); 
    581582    md = p.md; 
  • branches/dmdfe/mtype.c

    r658 r659  
    599599            error(e->loc, "%s.init is void", v->toChars()); 
    600600        else 
    601         {   e = v->init->toExpression(); 
     601        {   Loc loc = e->loc; 
     602            e = v->init->toExpression(); 
    602603            if (e->op == TOKassign || e->op == TOKconstruct) 
    603604            { 
     
    614615            } 
    615616            } 
     617            e = e->optimize(WANTvalue | WANTinterpret); 
     618//          if (!e->isConst()) 
     619//          error(loc, ".init cannot be evaluated at compile time"); 
    616620        } 
    617621        return e; 
     
    20112015    case Tfunction: 
    20122016    case Tnone: 
     2017    case Ttuple: 
    20132018        error(loc, "can't have array of %s", tbn->toChars()); 
    20142019        tn = next = tint32; 
     
    23542359    //printf("TypePointer::semantic()\n"); 
    23552360    Type *n = next->semantic(loc, sc); 
     2361    switch (n->toBasetype()->ty) 
     2362    { 
     2363    case Ttuple: 
     2364        error(loc, "can't have pointer to %s", n->toChars()); 
     2365        n = tint32; 
     2366        break; 
     2367    } 
    23562368    if (n != next) 
    23572369    deco = NULL; 
     
    38983910    if (ident == Id::init) 
    38993911    { 
    3900     if (e->op == TOKvar) 
    3901     { 
    3902         VarExp *ve = (VarExp *)e; 
    3903         VarDeclaration *v = ve->var->isVarDeclaration(); 
    3904  
    3905         assert(v); 
    3906         if (v->init) 
    3907         {   if (v->init->isVoidInitializer()) 
    3908             error(e->loc, "%s.init is void", v->toChars()); 
    3909         else 
    3910             return v->init->toExpression(); 
    3911         } 
    3912     } 
    3913     return defaultInit(); 
     3912    return Type::dotExp(sc, e, ident); 
    39143913    } 
    39153914    return sym->basetype->dotExp(sc, e, ident); 
  • branches/dmdfe/optimize.c

    r656 r659  
    6060{ 
    6161    //printf("Expression::optimize(result = x%x) %s\n", result, toChars()); 
     62    return this; 
     63} 
     64 
     65Expression *VarExp::optimize(int result) 
     66{ 
     67    if (result & WANTinterpret) 
     68    { 
     69    return fromConstInitializer(this); 
     70    } 
    6271    return this; 
    6372} 
  • branches/dmdfe/parse.c

    r657 r659  
    6161    endloc = 0; 
    6262    inBrackets = 0; 
    63     nextToken();      // start up the scanner 
     63    //nextToken();        // start up the scanner 
    6464} 
    6565 
     
    502502    case TOKcolon: 
    503503        nextToken(); 
    504 #if 1 
     504#if 0 
    505505        a = NULL; 
    506506#else 
  • branches/dmdfe/scope.c

    r458 r659  
    2727 
    2828void *Scope::operator new(size_t size) 
    29 {   Scope *s; 
    30  
     29
    3130    if (freelist) 
    3231    { 
    33     s = freelist; 
     32    Scope *s = freelist; 
    3433    freelist = s->enclosing; 
     34    //printf("freelist %p\n", s); 
     35    assert(s->flags & SCOPEfree); 
     36    s->flags &= ~SCOPEfree; 
    3537    return s; 
    3638    } 
    3739 
    38     return ::operator new(size); 
     40    void *p = ::operator new(size); 
     41    //printf("new %p\n", p); 
     42    return p; 
    3943} 
    4044 
     
    4246{   // Create root scope 
    4347 
     48    //printf("Scope::Scope() %p\n", this); 
    4449    this->module = NULL; 
    4550    this->scopesym = NULL; 
     
    7681Scope::Scope(Scope *enclosing) 
    7782{ 
     83    //printf("Scope::Scope(enclosing = %p) %p\n", enclosing, this); 
     84    assert(!(enclosing->flags & SCOPEfree)); 
    7885    this->module = enclosing->module; 
    7986    this->func   = enclosing->func; 
     
    8895    this->structalign = enclosing->structalign; 
    8996    this->enclosing = enclosing; 
     97#ifdef DEBUG 
     98    if (enclosing->enclosing) 
     99    assert(!(enclosing->enclosing->flags & SCOPEfree)); 
     100    if (this == enclosing->enclosing) 
     101    { 
     102    printf("this = %p, enclosing = %p, enclosing->enclosing = %p\n", this, enclosing, enclosing->enclosing); 
     103    } 
     104    assert(this != enclosing->enclosing); 
     105#endif 
    90106    this->slabel = NULL; 
    91107    this->linkage = enclosing->linkage; 
     
    149165Scope *Scope::pop() 
    150166{ 
    151     //printf("Scope::pop()\n"); 
     167    //printf("Scope::pop() %p nofree = %d\n", this, nofree); 
    152168    Scope *enc = enclosing; 
    153169 
     
    158174    {   enclosing = freelist; 
    159175    freelist = this; 
     176    flags |= SCOPEfree; 
    160177    } 
    161178 
     
    324341void Scope::setNoFree() 
    325342{   Scope *sc; 
    326  
    327     for (sc = this; sc; sc = sc->enclosing) 
    328     { 
     343    //int i = 0; 
     344 
     345    //printf("Scope::setNoFree(this = %p)\n", this); 
     346    for (sc = this; sc; sc = sc->enclosing) 
     347    { 
     348    //printf("\tsc = %p\n", sc); 
    329349    sc->nofree = 1; 
    330     } 
    331 
     350 
     351    assert(!(flags & SCOPEfree)); 
     352    //assert(sc != sc->enclosing); 
     353    //assert(!sc->enclosing || sc != sc->enclosing->enclosing); 
     354    //if (++i == 10) 
     355        //assert(0); 
     356    } 
     357
  • branches/dmdfe/scope.h

    r458 r659  
    7979#define SCOPEctor   1   // constructor type 
    8080#define SCOPEstaticif   2   // inside static if 
     81#define SCOPEfree   4   // is on free list 
    8182 
    8283    AnonymousAggregateDeclaration *anonAgg; // for temporary analysis 
  • branches/dmdfe/statement.c

    r658 r659  
    252252    Parser p(sc->module, (unsigned char *)se->string, se->len, 0); 
    253253    p.loc = loc; 
     254    p.nextToken(); 
    254255 
    255256    Statements *statements = new Statements(); 
     
    782783Statement *WhileStatement::syntaxCopy() 
    783784{ 
    784     WhileStatement *s = new WhileStatement(loc, condition->syntaxCopy(), body->syntaxCopy()); 
     785    WhileStatement *s = new WhileStatement(loc, condition->syntaxCopy(), body ? body->syntaxCopy() : NULL); 
    785786    return s; 
    786787} 
     
    822823    scd->sbreak = this; 
    823824    scd->scontinue = this; 
    824     body = body->semantic(scd); 
     825    if (body) 
     826    body = body->semantic(scd); 
    825827    scd->pop(); 
    826828 
     
    842844int WhileStatement::usesEH() 
    843845{ 
    844     return body->usesEH()
     846    return body ? body->usesEH() : 0
    845847} 
    846848 
    847849int WhileStatement::fallOffEnd() 
    848850{ 
    849     body->fallOffEnd(); 
     851    if (body) 
     852    body->fallOffEnd(); 
    850853    return TRUE; 
    851854} 
     
    864867    buf->writebyte(')'); 
    865868    buf->writenl(); 
    866     body->toCBuffer(buf, hgs); 
     869    if (body) 
     870    body->toCBuffer(buf, hgs); 
    867871} 
    868872 
     
    878882Statement *DoStatement::syntaxCopy() 
    879883{ 
    880     DoStatement *s = new DoStatement(loc, body->syntaxCopy(), condition->syntaxCopy()); 
     884    DoStatement *s = new DoStatement(loc, body ? body->syntaxCopy() : NULL, condition->syntaxCopy()); 
    881885    return s; 
    882886} 
     
    886890{ 
    887891    sc->noctor++; 
    888     body = body->semanticScope(sc, this, this); 
     892    if (body) 
     893    body = body->semanticScope(sc, this, this); 
    889894    sc->noctor--; 
    890895    condition = condition->semantic(sc); 
     
    908913int DoStatement::usesEH() 
    909914{ 
    910     return body->usesEH()
     915    return body ? body->usesEH() : 0
    911916} 
    912917 
    913918int DoStatement::fallOffEnd() 
    914919{ 
    915     body->fallOffEnd(); 
     920    if (body) 
     921    body->fallOffEnd(); 
    916922    return TRUE; 
    917923} 
     
    928934    buf->writestring("do"); 
    929935    buf->writenl(); 
    930     body->toCBuffer(buf, hgs); 
     936    if (body) 
     937    body->toCBuffer(buf, hgs); 
    931938    buf->writestring("while ("); 
    932939    condition->toCBuffer(buf, hgs); 
     
    11931200            arg->type = e->type; 
    11941201            Initializer *ie = new ExpInitializer(0, e); 
    1195             var = new VarDeclaration(loc, arg->type, arg->ident, ie); 
     1202            VarDeclaration *v = new VarDeclaration(loc, arg->type, arg->ident, ie); 
     1203            if (e->isConst()) 
     1204            v->storage_class |= STCconst; 
     1205#if V2 
     1206            else 
     1207            v->storage_class |= STCfinal; 
     1208#endif 
     1209            var = v; 
    11961210        } 
    11971211        } 
     
    20582072int SwitchStatement::usesEH() 
    20592073{ 
    2060     return body->usesEH()
     2074    return body ? body->usesEH() : 0
    20612075} 
    20622076 
    20632077int SwitchStatement::fallOffEnd() 
    20642078{ 
    2065     body->fallOffEnd(); 
     2079    if (body) 
     2080    body->fallOffEnd(); 
    20662081    return TRUE;    // need to do this better 
    20672082} 
     
    28222837{ 
    28232838    Expression *e = exp ? exp->syntaxCopy() : NULL; 
    2824     SynchronizedStatement *s = new SynchronizedStatement(loc, e, body->syntaxCopy()); 
     2839    SynchronizedStatement *s = new SynchronizedStatement(loc, e, body ? body->syntaxCopy() : NULL); 
    28252840    return s; 
    28262841} 
     
    28442859    } 
    28452860    } 
    2846     body = body->semantic(sc); 
     2861    if (body) 
     2862    body = body->semantic(sc); 
    28472863    return this; 
    28482864} 
     
    28652881int SynchronizedStatement::fallOffEnd() 
    28662882{ 
    2867     return body->fallOffEnd()
     2883    return body ? body->fallOffEnd() : TRUE
    28682884} 
    28692885 
     
    28952911Statement *WithStatement::syntaxCopy() 
    28962912{ 
    2897     WithStatement *s = new WithStatement(loc, exp->syntaxCopy(), body->syntaxCopy()); 
     2913    WithStatement *s = new WithStatement(loc, exp->syntaxCopy(), body ? body->syntaxCopy() : NULL); 
    28982914    return s; 
    28992915} 
     
    29512967    sc = sc->push(sym); 
    29522968 
    2953     body = body->semantic(sc); 
     2969    if (body) 
     2970    body = body->semantic(sc); 
    29542971 
    29552972    sc->pop(); 
     
    29632980    exp->toCBuffer(buf, hgs); 
    29642981    buf->writestring(")\n"); 
    2965     body->toCBuffer(buf, hgs); 
     2982    if (body) 
     2983    body->toCBuffer(buf, hgs); 
    29662984} 
    29672985 
    29682986int WithStatement::usesEH() 
    29692987{ 
    2970     return body->usesEH()
     2988    return body ? body->usesEH() : 0
    29712989} 
    29722990 
    29732991int WithStatement::fallOffEnd() 
    29742992{ 
    2975     return body->fallOffEnd()
     2993    return body ? body->fallOffEnd() : TRUE
    29762994} 
    29772995 
     
    30163034        char *sj = cj->loc.toChars(); 
    30173035 
    3018         if (c->type->implicitConvTo(cj->type)) 
     3036        if (c->type->toBasetype()->implicitConvTo(cj->type->toBasetype())) 
    30193037        error("catch at %s hides catch at %s", sj, si); 
    30203038    } 
     
    33443362Statement *VolatileStatement::semantic(Scope *sc) 
    33453363{ 
    3346     statement = statement->semantic(sc)
     3364    statement = statement ? statement->semantic(sc) : NULL
    33473365    return this; 
    33483366} 
     
    33523370    Statements *a; 
    33533371 
    3354     a = statement->flatten(sc)
     3372    a = statement ? statement->flatten(sc) : NULL
    33553373    if (a) 
    33563374    {   for (int i = 0; i < a->dim; i++) 
     
    33673385int VolatileStatement::fallOffEnd() 
    33683386{ 
    3369     return statement->fallOffEnd()
     3387    return statement ? statement->fallOffEnd() : TRUE
    33703388} 
    33713389 
  • branches/dmdfe/template.c

    r658 r659  
    11311131    if (equals(at)) 
    11321132        goto Lexact; 
     1133    else if (ty == Tclass && at->ty == Tclass) 
     1134    { 
     1135        return (MATCH) implicitConvTo(at); 
     1136    } 
    11331137    else if (ty == Tsarray && at->ty == Tarray && 
    11341138        next->equals(at->next))