When N == 0, the compiler still has to instantiate f2<-1> because the function call is present in the code. When f<-1> is instantiated, f<-2> is instantiated and so on. Applying this statement again and again, the compiler will keep recursing through the template until it exceeds the max depth.