I have compiled following program in GCC using C++14
.
#include <iostream>
using namespace std;
auto func(int i);
int main()
{
auto ret = func(5);
return 0;
}
auto func(int i)
{
if (i == 1)
return i;
else
return func(i-1) + i;
}
But, I get the following error.
In function 'int main()': 8:16: error: use of 'auto func(int)' before
deduction of 'auto'
auto ret = func(5);
So, what am I missing here?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…