prog.cpp:4:21: error: cannot deduce return type from initializer list
auto sum() { return {}; }
^~
prog.cpp:9:17: error: no matching function for call to 'sum'
return head+sum(tail...);
^~~
prog.cpp:9:17: note: in instantiation of function template specialization 'sum<double>' requested here
prog.cpp:13:12: note: in instantiation of function template specialization 'sum<int, double>' requested here
cout<< sum(1,2.4) << endl;
^
prog.cpp:7:6: note: candidate function template not viable: requires at least argument 'head', but no arguments were provided
auto sum(Head head, Tail... tail)
^
prog.cpp:9:17: error: no matching function for call to 'sum'
return head+sum(tail...);
^~~
prog.cpp:9:17: note: in instantiation of function template specialization 'sum<const char *>' requested here
prog.cpp:14:12: note: in instantiation of function template specialization 'sum<const char *, const char *>' requested here
cout<< sum("hello ", "world") << endl;
^
prog.cpp:7:6: note: candidate function template not viable: requires at least argument 'head', but no arguments were provided
auto sum(Head head, Tail... tail)
^
3 errors generated.