Is it possible to write something like this in the compile time? auto foo(T)(T t) if (is(T == immutable(int)) && t == 5) // Error: variable t cannot be read at compile time { // ... } void main() { immutable(int) n = 5; foo(n); }