Call to immutable method during immutable construction

Jens Mueller jens.k.mueller at gmx.de
Wed Nov 10 06:14:07 PST 2010


Hi,

according to TDPL p. 294 the following call to fun should not be
allowed. But it compiles and I see not why that shouldn't be allowed. I think
it's a bug in TDPL but I'm unsure.

class A {
    int a;
    int[] b;
    this() immutable {
        a = 5;
        b = [ 1, 2, 3 ];
        fun();
    }
    void fun() immutable {
    }
}

Any opinions?

Jens


More information about the Digitalmars-d mailing list