[Issue 10496] Initialization in lazy function parameter allows immutable member not to be initialized

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 28 09:21:48 PDT 2013


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


Dicebot <m.strashun at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |m.strashun at gmail.com


--- Comment #1 from Dicebot <m.strashun at gmail.com> 2013-06-28 09:21:47 PDT ---
I think this is part of a bigger problem:

----------------------------------------
class A
{
    immutable int x;

    void delegate() f;

    this()
    {
        x = 40;
        f = () { x = 42; };
    }
}

void main()
{
    import std.stdio;
    auto a = new A();
    writeln(a.x);
    a.f();
    writeln(a.x);
}
----------------------------------------

40
42

-- 
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