Didn't this used to work? template factorial(int i) { enum factorial = (i==0) ? 1 : i*factorial!(i-1); } With DMD 2.036 I'm getting: Error: template instance factorial!(-495) recursive expansion Seems like it expands both branches regardless of the condition. And seems to me like it shouldn't. --bb