[Issue 7428] regression (DMD 2.058head) ICE on slightly convoluted setup including closures

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 4 18:41:54 PST 2012


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


Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at digitalmars.com


--- Comment #1 from Walter Bright <bugzilla at digitalmars.com> 2012-02-04 18:41:52 PST ---
I simplified this a bit (still hurts my brain, though). The bug is tripped when
a lambda is used rather than the equivalent nested function:

alias long delegate(long) dg_t;

void Y(dg_t delegate (dg_t) y)
{
    struct F { long delegate(F) f; };

  version (all)
  { // generates error
    (dg_t delegate(F) a){return a(F((F b){return y(a(b))(1);})); }
    ((F b){return (long n){return b.f(b);};});
  }
  else
  {
    auto abc(dg_t delegate(F) a)
    {
        return a(F((F b){return y(a(b))(1);}));
    }

    abc((F b){return (long n){return b.f(b);};});
  }
}


void main(){
    auto foo(dg_t self)
    {
        auto bar(long i) { return self(1); }
        return &bar;
    }

    Y(&foo);
}

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


More information about the Digitalmars-d-bugs mailing list