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


Denis Shelomovskij <verylonglogin....@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |verylonglogin....@gmail.com
         Resolution|                            |DUPLICATE


--- Comment #3 from Denis Shelomovskij <verylonglogin....@gmail.com> 2012-11-12 
12:25:48 MSK ---
The issue isn't with `opAssign`. It is because closure isn't detected:
---
import std.stdio;

void setDel()(Foo foo, void delegate() del)
{ foo.del = del; }

class Foo
{
    void delegate() del;

    void f()
    {
        writefln("%X, %X (instance and ref addresses)", cast(void*) this,
&this);
        void g() { writefln("%X, %X (instance and ref addresses from g)",
cast(void*) this, &this); }
        setDel(this, &g);
        writefln("%X (del.ptr)", del.ptr);
    }

    void callDel()
    {
        writefln("+callDel");
        del();
        writefln("-callDel");
    }
}

void main()
{
    auto foo = new Foo();
    foo.f();
    foo.del();
    foo.callDel();
    foo.del();
}
---

Output:
---
A01E70, 12FE58 (instance and ref addresses)
12FE58 (del.ptr)
12FE58, 12FE58 (instance and ref addresses from g)
+callDel
A01E70, 12FE58 (instance and ref addresses from g)
-callDel
12FE58, 12FE58 (instance and ref addresses from g)
---

Created a new issue with corrected title and description.

*** This issue has been marked as a duplicate of issue 8999 ***

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

Reply via email to