mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-12 19:03:13 +01:00
Temporary variables cannot be referenced inside a closure
This commit is contained in:
@@ -404,7 +404,8 @@ void DtoCreateNestedContext(FuncDeclaration* fd) {
|
||||
// Create frame for current function and append to frames list
|
||||
// FIXME: alignment ?
|
||||
LLValue* frame = 0;
|
||||
if (fd->needsClosure())
|
||||
bool needsClosure = fd->needsClosure();
|
||||
if (needsClosure)
|
||||
frame = DtoGcMalloc(frameType, ".frame");
|
||||
else
|
||||
frame = DtoRawAlloca(frameType, 0, ".frame");
|
||||
@@ -448,6 +449,9 @@ void DtoCreateNestedContext(FuncDeclaration* fd) {
|
||||
I != E; ++I) {
|
||||
VarDeclaration *vd = *I;
|
||||
|
||||
if (needsClosure && vd->needsAutoDtor())
|
||||
vd->error("has scoped destruction, cannot build closure");
|
||||
|
||||
LLValue* gep = DtoGEPi(frame, 0, vd->ir.irLocal->nestedIndex, vd->toChars());
|
||||
if (vd->isParameter()) {
|
||||
Logger::println("nested param: %s", vd->toChars());
|
||||
|
||||
Reference in New Issue
Block a user