Run this code: class PP {}
void what(T)(T val) { static if (is(T == int)) writeln ("T == int"); static if (is(T == const(int))) writeln ("T == const(int)"); static if (is(T : int)) writeln ("T : int"); static if (is(T == PP)) writeln ("T == PP"); static if (is(T == const(PP))) writeln ("T == const(PP)"); static if (is(T : PP)) writeln ("T : PP"); } void main(string[] args) { const int aa = 10; int ab; const PP ba = new PP; PP bb = new PP; writeln("- Testing const(int)"); what(aa); writeln(); writeln("- Testing int"); what(ab); writeln(); writeln("- Testing const(PP)"); what(ba); writeln(); writeln("- Testing PP"); what(bb); writeln(); return; } It says: - Testing const(int) T == const(int) T : int - Testing int T == int T : int - Testing const(PP) T == const(PP) - Testing PP T == PP T : PP So: const(int) : int <-- true const(PP) : PP <-- false Is this behaviour correct? And how can I check if T is of a certain class ignoring consts (and avoiding double checks)?