Templates with alias param instantiated with null cached by DMD..?

simendsjo simendsjo at gmail.com
Wed Oct 23 00:22:55 PDT 2013


I've stumbled upon a strange bug, and I'm not sure what I should 
write in the bug report. Could someone explain what's going on 
here or file the bug for me?

template A(alias T) {
     alias A = T;
}

void main() {
     struct S1 { S1* p; }
     static assert(is(typeof(A!(S1.init.p)) == S1*)); // ok

     pragma(msg, "NULL: ", typeof(A!(null))); // fail: S1*

     struct S2 { S2* p; }
     static assert(is(typeof(A!(S2.init.p)) == S2*)); // fail: S1*
}


More information about the Digitalmars-d-learn mailing list