Merged DMD commit 91a91bcb7882d76e2afd844f14697a75175573d2:

bugzilla 5230 Regression(2.041, 1.057) ICE(tocsym.c) overriding a method that has an out contract
This commit is contained in:
David Nadlinger
2011-04-22 18:47:10 +02:00
parent 4e0a896557
commit f12d7471a3

View File

@@ -1660,6 +1660,19 @@ Statement *FuncDeclaration::mergeFensure(Statement *sf)
for (int i = 0; i < foverrides.dim; i++)
{
FuncDeclaration *fdv = (FuncDeclaration *)foverrides.data[i];
/* The semantic pass on the contracts of the overridden functions must
* be completed before code generation occurs (bug 3602 and 5230).
*/
if (fdv->fdensure && fdv->fdensure->semanticRun != PASSsemantic3done)
{
assert(fdv->scope);
Scope *sc = fdv->scope->push();
sc->stc &= ~STCoverride;
fdv->semantic3(sc);
sc->pop();
}
sf = fdv->mergeFensure(sf);
if (fdv->fdensure)
{