In C++ it is supported at lead for function templates:
template<class T>
T foo(int x)
{
if(x>10) {
// ... do something interesting
return foo<T>(x-1);
} else {
// ... do something else and finally
return foo<T>(x*3);
}
}
int main()
{
foo<double>(23);
foo<void>(42);
}
Lars R.