https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77958

--- Comment #3 from Daniel Fruzynski <bugzi...@poradnik-webmastera.com> ---
This attribute should also work when some parameters are not variadic ones. One
use case presented in bug 79680 is to have two overloaded logging function: one
printf-like, and another one which accepts constant string only. So something
like this should work too:

template<typename Arg1, typename... Args>
static void
 __attribute__ ((format (printf, 1, 2)))
whatever(const char *fmt, Arg1&& arg1, Args&&... args)
{
  printf(fmt, arg1, args...);
}

Please also consider case when type of arg1 is specified explicitly, someone
may find it useful too:

template<typename... Args>
static void
 __attribute__ ((format (printf, 1, 2)))
whatever(const char *fmt, int arg1, Args&&... args)
{
  printf(fmt, arg1, args...);
}

Reply via email to