Is it just me, or did I subvert the type system here?


import std.stdio;

struct Const
{
        this(void delegate() increment)
        { this.increment = increment; }
        int a;
        void delegate() increment;
        void oops() const { this.increment(); }
}

void main()
{
        Const c;
        c = Const({ c.a++; });
        writeln(c.a);
        c.oops();
        writeln(c.a);
}

Reply via email to