mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-11 18:33:14 +01:00
Check in DtoNestedVariable() whether the needed frame can be accessed
This commit is contained in:
@@ -100,6 +100,17 @@ DValue* DtoNestedVariable(Loc loc, Type* astype, VarDeclaration* vd, bool byref)
|
||||
assert(vdparent);
|
||||
|
||||
IrFunction* irfunc = gIR->func();
|
||||
|
||||
// Check whether we can access the needed frame
|
||||
FuncDeclaration *fd = irfunc->decl;
|
||||
while (fd != vdparent) {
|
||||
if (fd->isStatic()) {
|
||||
error(loc, "function %s cannot access frame of function %s", irfunc->decl->toPrettyChars(), vdparent->toPrettyChars());
|
||||
return new DVarValue(astype, vd, llvm::UndefValue::get(getPtrToType(DtoType(astype))));
|
||||
}
|
||||
fd = getParentFunc(fd, false);
|
||||
assert(fd);
|
||||
}
|
||||
|
||||
// is the nested variable in this scope?
|
||||
if (vdparent == irfunc->decl)
|
||||
|
||||
Reference in New Issue
Block a user