On 12/05/2013 09:33 PM, Jesse Phillips wrote:

I don't think I understand what you mean:

this code illustrates it:

class Z {
    string a() immutable {
        return " 1";
    }
    string b() {
        return "2";
    }
}

template F(t) {
    alias immutable(t) F;
}
alias typeof(&Z.init.a) Texpected;
alias typeof(&Z.init.a) T;

static assert(is(F!(T) == Texpected));

void main() {}



above F doesn't work; immutable(void delegate()) and void delegate() immutable are different types (I think the latter means 'this' is immutable). If t were a function pointer, you would apply the immutable to the pointer target like so:

alias immutable(pointerTarget!t)* F


Reply via email to