Attached closure-related test cases fail.
closure5w.d: Segfaults. Only f() creates a closure and 'dg = & i' does not get a
valid reference to it.
closure8w.d: Fails with ArrayBoundsError.
closure11w.d: Assert fails. The tests in Function::needsClosure only
check f->isVirtual(), but a virtual function can call a non-virtual
function which does non-local access. I fixed this in GDC by
testing f->isThis() instead.
closure13w.d: Assert fails. DotVarExp::semantic does not call
checkNestedReference for the 'this' of an outer function.
I fixed this in GDC by adding a semantic() call:
// Skip over nested functions, and get the enclosing
// class type.
Dsymbol *s = tcd->toParent();
while (s && s->isFuncDeclaration())
{ FuncDeclaration *f = s->isFuncDeclaration();
if (f->vthis)
{
e1 = new VarExp(loc, f->vthis);
}
s = s->toParent();
}
if (s && s->isClassDeclaration())
e1->type = s->isClassDeclaration()->type;
+ e1 = e1->semantic(sc); // Added to get corrected nested refs
goto L1;
Comment #1 by dvdfrdmn — 2008-03-11T19:25:14Z
Created attachment 234
Test case closure5w
Comment #2 by dvdfrdmn — 2008-03-11T19:26:47Z
Created attachment 235
Test case closure8w
Comment #3 by dvdfrdmn — 2008-03-11T19:27:27Z
Created attachment 236
Test case closure11w
Comment #4 by dvdfrdmn — 2008-03-11T19:28:07Z
Created attachment 237
Test case closure13w
Comment #5 by dvdfrdmn — 2008-03-11T19:41:22Z
Created attachment 238
Test case closure14
Similar to closure13w, but causes an ICE. Also affects DMD 1.x.
Comment #6 by bugzilla — 2008-04-24T04:44:46Z
Patches for 11w and 13w were folded in to DMD 2.013. 13w was folded in to DMD 1.029, fixing 14.
5w and 8w are left.
Comment #7 by clugdbug — 2010-10-19T23:55:58Z
Test case 8w is a duplicate of bug 3326, and isn't actually a closure bug.
Test case 5w is a duplicate of bug 1841. I'm therefore closing this bug, as the other cases have been fixed.