Quantcast
Viewing latest article 3
Browse Latest Browse All 5

Answer by songyuanyao for Use of 'auto func(int)' before deduction of 'auto' in C++14

When auto is used as the return type in a function declaration that does not use the trailing return type syntax, the keyword auto indicates that the return type will be deduced from the operand of its return statement. That means the deduction can't be performed until the definition of the function func(), but before that it has been used in main().

You could move the definition before main(), or use trailing return type syntax to specify the return type on the declaration.


Viewing latest article 3
Browse Latest Browse All 5

Trending Articles