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

Changeset 782

Show
Ignore:
Timestamp:
12/06/10 00:30:59 (14 years ago)
Author:
walter
Message:

bugzilla 5145 Regression(2.050, 1.065) override error with forward ref of superclass

Files:

Legend:

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

    r781 r782  
    15321532     * place by definition, since it's an overriding function. The problem is 
    15331533     * getting the 'this' pointer in the same place, since it is a local variable. 
    15341534     * We did some hacks in the code generator to make this happen: 
    15351535     *  1. always generate exception handler frame, or at least leave space for it 
    15361536     *     in the frame (Windows 32 SEH only) 
    15371537     *  2. always generate an EBP style frame 
    15381538     *  3. since 'this' is passed in a register that is subsequently copied into 
    15391539     *     a stack local, allocate that local immediately following the exception 
    15401540     *     handler block, so it is always at the same offset from EBP. 
    15411541     */ 
    15421542    for (int i = 0; i < foverrides.dim; i++) 
    15431543    { 
    15441544        FuncDeclaration *fdv = (FuncDeclaration *)foverrides.data[i]; 
    15451545 
    15461546        /* The semantic pass on the contracts of the overridden functions must 
    15471547         * be completed before code generation occurs (bug 3602). 
    15481548         */ 
    15491549        if (fdv->fdrequire && fdv->fdrequire->semanticRun != PASSsemantic3done) 
    15501550        { 
    15511551            assert(fdv->scope); 
    1552             fdv->semantic3(fdv->scope); 
     1552            Scope *sc = fdv->scope->push(); 
     1553            sc->stc &= ~STCoverride; 
     1554            fdv->semantic3(sc); 
     1555            sc->pop(); 
    15531556        } 
    15541557 
    15551558        sf = fdv->mergeFrequire(sf); 
    15561559        if (fdv->fdrequire) 
    15571560        { 
    15581561            //printf("fdv->frequire: %s\n", fdv->frequire->toChars()); 
    15591562            /* Make the call: 
    15601563             *   try { __require(); } 
    15611564             *   catch { frequire; } 
    15621565             */ 
    15631566            Expression *eresult = NULL; 
    15641567            Expression *e = new CallExp(loc, new VarExp(loc, fdv->fdrequire), eresult); 
    15651568            Statement *s2 = new ExpStatement(loc, e); 
    15661569 
    15671570            if (sf) 
    15681571            {   Catch *c = new Catch(loc, NULL, NULL, sf); 
    15691572                Array *catches = new Array(); 
    15701573                catches->push(c); 
    15711574                sf = new TryCatchStatement(loc, s2, catches); 
    15721575            } 
  • trunk/src/func.c

    r781 r782  
    16751675     * place by definition, since it's an overriding function. The problem is 
    16761676     * getting the 'this' pointer in the same place, since it is a local variable. 
    16771677     * We did some hacks in the code generator to make this happen: 
    16781678     *  1. always generate exception handler frame, or at least leave space for it 
    16791679     *     in the frame (Windows 32 SEH only) 
    16801680     *  2. always generate an EBP style frame 
    16811681     *  3. since 'this' is passed in a register that is subsequently copied into 
    16821682     *     a stack local, allocate that local immediately following the exception 
    16831683     *     handler block, so it is always at the same offset from EBP. 
    16841684     */ 
    16851685    for (int i = 0; i < foverrides.dim; i++) 
    16861686    { 
    16871687        FuncDeclaration *fdv = (FuncDeclaration *)foverrides.data[i]; 
    16881688 
    16891689        /* The semantic pass on the contracts of the overridden functions must 
    16901690         * be completed before code generation occurs (bug 3602). 
    16911691         */ 
    16921692        if (fdv->fdrequire && fdv->fdrequire->semanticRun != PASSsemantic3done) 
    16931693        { 
    16941694            assert(fdv->scope); 
    1695             fdv->semantic3(fdv->scope); 
     1695            Scope *sc = fdv->scope->push(); 
     1696            sc->stc &= ~STCoverride; 
     1697            fdv->semantic3(sc); 
     1698            sc->pop(); 
    16961699        } 
    16971700 
    16981701        sf = fdv->mergeFrequire(sf); 
    16991702        if (fdv->fdrequire) 
    17001703        { 
    17011704            //printf("fdv->frequire: %s\n", fdv->frequire->toChars()); 
    17021705            /* Make the call: 
    17031706             *   try { __require(); } 
    17041707             *   catch { frequire; } 
    17051708             */ 
    17061709            Expression *eresult = NULL; 
    17071710            Expression *e = new CallExp(loc, new VarExp(loc, fdv->fdrequire, 0), eresult); 
    17081711            Statement *s2 = new ExpStatement(loc, e); 
    17091712 
    17101713            if (sf) 
    17111714            {   Catch *c = new Catch(loc, NULL, NULL, sf); 
    17121715                Array *catches = new Array(); 
    17131716                catches->push(c); 
    17141717                sf = new TryCatchStatement(loc, s2, catches); 
    17151718            }