http://d.puremagic.com/issues/show_bug.cgi?id=1841


Don <clugd...@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugd...@yahoo.com.au


--- Comment #2 from Don <clugd...@yahoo.com.au> 2010-07-27 00:03:36 PDT ---
Here's a clearer test case. The second assert fails.

Closure detection works correctly if you change the delegate literal to:
  return delegate int() { int x=heap; return nested_func(); };

---------------------
//import std.stdio;

int delegate() Foo()
{
  int stack;
  int heap=3;
//  writeln("&stack=",&stack,"   &heap=",&heap);

  int nested_func()
  {
    ++heap;
    return heap;
  }
  return delegate int() { return nested_func(); };
}

void main()
{
  auto z = Foo();
  auto p = Foo();
  assert(z()==4); // OK
  p();
  assert(z()==5);  // fails
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to