Yah slarty is correct.

Remember a templated function

template <>
void foo<1>();

is different then

template <>
void foo<2>();

So when foo<1>() calls foo<2>() it actually isn't calling the function recursively because each function will be generated by the compiler seperatly. Your compiler should fail the way slarty does and it fails because of the maximum depth templates can be generated which is an option that can be turned off.