Skip to content

Commit

Permalink
fix Issue 2962 - ICE(glue.c) or bad codegen passing variable as templ…
Browse files Browse the repository at this point in the history
…ate value parameter
  • Loading branch information
WalterBright committed Apr 25, 2012
1 parent 8208fcf commit d5a33a1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,20 @@ void FuncDeclaration::toObjFile(int multiobj)
// if (!(config.flags3 & CFG3pic))
// s->Sclass = SCstatic;
f->Fflags3 |= Fnested;

/* The enclosing function must have its code generated first,
* so we know things like where its local symbols are stored.
*/
FuncDeclaration *fdp = toParent2()->isFuncDeclaration();
if (fdp && fdp->semanticRun == PASSsemantic3done &&
!fdp->isUnitTestDeclaration())
{
/* Can't do unittest's out of order, they are order dependent in that their
* execution is done in lexical order, and some modules (std.datetime *cough*
* *cough*) rely on this.
*/
fdp->toObjFile(multiobj);
}
}
else
{
Expand Down

0 comments on commit d5a33a1

Please sign in to comment.