mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-13 22:48:43 +03:00
Check in DtoNestedVariable() whether the needed frame can be accessed
This commit is contained in:
parent
67daf2fe0a
commit
21659b6a5d
1 changed files with 11 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue