Following code compiles :
auto foo(int i) { if( i == 1 ) return i; else return foo(i-1)+i ; }
While following doesn\'t,
A recursive function can have an auto return type only if it has a non-recursive return statement before the recursive call. See Return type deduction for normal functions.