Quantcast
Channel: Use of 'auto func(int)' before deduction of 'auto' in C++14 - Stack Overflow
Viewing all articles
Browse latest Browse all 5

Use of 'auto func(int)' before deduction of 'auto' in C++14

$
0
0

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)' beforededuction of 'auto' auto ret = func(5);

So, what am I missing here?


Viewing all articles
Browse latest Browse all 5

Trending Articles