prog.cpp:14:48: error: ‘index’ was not declared in this scope
-> decltype(func(std::forward<Args>(args)..., index++)) //get return type
^
prog.cpp:14:48: error: ‘index’ was not declared in this scope
prog.cpp: In function ‘int main()’:
prog.cpp:48:16: error: no match for call to ‘(IndexFunctor<main()::__lambda0>) (int)’
int a = f(5);
^
prog.cpp:5:7: note: candidate is:
class IndexFunctor
^
prog.cpp:13:7: note: template<class ... Args> decltype (func((forward<Args>)(IndexFunctor::operator()::args)..., <expression error>)) IndexFunctor<FUNC>::operator()(Args&& ...) [with Args = {Args ...}; FUNC = main()::__lambda0]
auto operator ()(Args&&... args)
^
prog.cpp:13:7: note: template argument deduction/substitution failed:
prog.cpp: In substitution of ‘template<class ... Args> decltype (func((forward<Args>)(IndexFunctor::operator()::args)..., <expression error>)) IndexFunctor<FUNC>::operator()(Args&& ...) [with Args = {Args ...}; FUNC = main()::__lambda0] [with Args = {int}]’:
prog.cpp:48:16: required from here
prog.cpp:14:55: error: ‘func’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
-> decltype(func(std::forward<Args>(args)..., index++)) //get return type
^
prog.cpp:14:55: note: declarations in dependent base ‘IndexFunctor<main()::__lambda0>’ are not found by unqualified lookup
prog.cpp:14:55: note: use ‘IndexFunctor::func’ instead