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

           Summary: Const function modifies a field when passed a delegate
           Product: D
           Version: 2.036
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: tomeks...@gmail.com


--- Comment #0 from Tomasz SowiƄski <tomeks...@gmail.com> 2009-11-28 04:43:30 
PST ---
I believe this should not compile:

class A
{ public:
    int pole;

    void funkcja(void delegate(int) dg) const
    {
        dg(3);
    }
}

void main()
{
    A a = new A;

    void zmien(int w)
    {
        a.pole = w;
    }

    a.funkcja(&zmien);  // pole changed by calling const funkcja
    assert (a.pole == 3);
}

Looks very similar to bug 3534.

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

Reply via email to