https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104343
Bug ID: 104343 Summary: Too many arguments error reported for a variadic-argument function if std::endl is passed Product: gcc Version: 7.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ethouris at gmail dot com Target Milestone: --- I have the following definition (requires `<string>` and `<stringstream>`): ``` template <class Stream> inline Stream& Print(Stream& in) { return in;} template <class Stream, class Arg1, class... Args> inline Stream& Print(Stream& sout, Arg1&& arg1, Args&&... args) { sout << arg1; return Print(sout, args...); } template <class... Args> inline std::string Sprint(Args&&... args) { std::ostringstream sout; Print(sout, args...); return sout.str(); } ``` The call ``` sinfo.bufferinfo = Sprint("B: off=", buffer.offset(), " now=", FormatTime(timeinfo), endl); ``` Reports this error: ``` (5 of 13): error: too many arguments to function 'std::__cxx11::string Sprint(Args&& ...) [with Args = {}; std::__cxx11::string = std::__cxx11::basic_string<char>]' ``` Replacing `endl` with `"\n"` fixes the problem. Might be that I cannot bind `std::endl` to the argument as given here, but the error report is at least misleading. How can there be "too many arguments" passed to a function that gets a variable number of arguments?