Fixed two issues with nested functions as template alias parameters.

Fixes #131 (GitHub).
This commit is contained in:
David Nadlinger 2012-10-07 02:40:10 +02:00
parent da17b7c6b6
commit 051cd7302e
3 changed files with 43 additions and 10 deletions

View file

@ -193,6 +193,14 @@ void DtoResolveNestedContext(Loc loc, ClassDeclaration *decl, LLValue *value)
// store into right location
if (!llvm::dyn_cast<llvm::UndefValue>(nest)) {
// Need to make sure the declaration has already been resolved, because
// when multiple source files are specified on the command line, the
// frontend sometimes adds "nested" (i.e. a template in module B
// instantiated from module A with a type from module A instantiates
// another template from module B) into the wrong module, messing up
// our codegen order.
DtoResolveDsymbol(decl);
size_t idx = decl->vthis->ir.irField->index;
LLValue* gep = DtoGEPi(value,0,idx,".vthis");
DtoStore(DtoBitCast(nest, gep->getType()->getContainedType(0)), gep);