Bug 2188 – man-or-boy test fails with access violation
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2008-07-01T01:56:00Z
Last change time
2015-06-09T01:19:51Z
Assigned to
bugzilla
Creator
bugzilla
Comments
Comment #0 by bugzilla — 2008-07-01T01:56:39Z
because it doesn't handle lazy parameters right when generating a closure. Works fine in D 1.0.
int a(int k, lazy int x1, lazy int x2, lazy int x3, lazy int x4, lazy int x5)
{
int delegate() b;
b = { k -= 1; return a(k, b(), x1, x2, x3, x4); };
if (k <= 0)
return x4 + x5;
else
return b();
}
int main()
{
assert(a(10, 1, -1, -1, 1, 0) == -67);
return 0;
}