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

Changeset 404

Show
Ignore:
Timestamp:
03/02/10 20:38:55 (15 years ago)
Author:
walter
Message:

bugzilla 3803 compiler segfaults

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/dmd-1.x/src/expression.c

    r396 r404  
    59155915 
    59165916Expression *DotTemplateInstanceExp::semantic(Scope *sc) 
    59175917{ 
    59185918#if 1 
    59195919#if LOGSEMANTIC 
    59205920    printf("DotTemplateInstanceExp::semantic('%s')\n", toChars()); 
    59215921#endif 
    59225922    Expression *eleft; 
    59235923    Expression *e = new DotIdExp(loc, e1, ti->name); 
    59245924L1: 
    59255925    e = e->semantic(sc); 
    59265926    if (e->op == TOKdottd) 
    59275927    { 
    59285928    if (global.errors) 
    59295929        return new ErrorExp();  // TemplateInstance::semantic() will fail anyway 
    59305930    DotTemplateExp *dte = (DotTemplateExp *)e; 
    59315931    TemplateDeclaration *td = dte->td; 
    59325932    eleft = dte->e1; 
    59335933    ti->tempdecl = td; 
    59345934    ti->semantic(sc); 
     5935    if (!ti->inst)          // if template failed to expand 
     5936        return new ErrorExp(); 
    59355937    Dsymbol *s = ti->inst->toAlias(); 
    59365938    Declaration *v = s->isDeclaration(); 
    59375939    if (v) 
    59385940    {   e = new DotVarExp(loc, eleft, v); 
    59395941        e = e->semantic(sc); 
    59405942        return e; 
    59415943    } 
    59425944    e = new ScopeExp(loc, ti); 
    59435945    e = new DotExp(loc, eleft, e); 
    59445946    e = e->semantic(sc); 
    59455947    return e; 
    59465948    } 
    59475949    else if (e->op == TOKimport) 
    59485950    {   ScopeExp *se = (ScopeExp *)e; 
    59495951    TemplateDeclaration *td = se->sds->isTemplateDeclaration(); 
    59505952    if (!td) 
    59515953    {   error("%s is not a template", e->toChars()); 
    59525954        return new ErrorExp(); 
    59535955    } 
    59545956    ti->tempdecl = td; 
  • trunk/src/expression.c

    r403 r404  
    62716271} 
    62726272 
    62736273Expression *DotTemplateInstanceExp::semantic(Scope *sc) 
    62746274{ 
    62756275#if LOGSEMANTIC 
    62766276    printf("DotTemplateInstanceExp::semantic('%s')\n", toChars()); 
    62776277#endif 
    62786278    Expression *eleft; 
    62796279    Expression *e = new DotIdExp(loc, e1, ti->name); 
    62806280L1: 
    62816281    e = e->semantic(sc); 
    62826282    if (e->op == TOKdottd) 
    62836283    { 
    62846284    if (global.errors) 
    62856285        return new ErrorExp();  // TemplateInstance::semantic() will fail anyway 
    62866286    DotTemplateExp *dte = (DotTemplateExp *)e; 
    62876287    TemplateDeclaration *td = dte->td; 
    62886288    eleft = dte->e1; 
    62896289    ti->tempdecl = td; 
    62906290    ti->semantic(sc); 
     6291    if (!ti->inst)          // if template failed to expand 
     6292        return new ErrorExp(); 
    62916293    Dsymbol *s = ti->inst->toAlias(); 
    62926294    Declaration *v = s->isDeclaration(); 
    62936295    if (v) 
    62946296    {   e = new DotVarExp(loc, eleft, v); 
    62956297        e = e->semantic(sc); 
    62966298        return e; 
    62976299    } 
    62986300    e = new ScopeExp(loc, ti); 
    62996301    e = new DotExp(loc, eleft, e); 
    63006302    e = e->semantic(sc); 
    63016303    return e; 
    63026304    } 
    63036305    else if (e->op == TOKimport) 
    63046306    {   ScopeExp *se = (ScopeExp *)e; 
    63056307    TemplateDeclaration *td = se->sds->isTemplateDeclaration(); 
    63066308    if (!td) 
    63076309    {   error("%s is not a template", e->toChars()); 
    63086310        return new ErrorExp(); 
    63096311    } 
    63106312    ti->tempdecl = td;