How to use source_location in a variadic template function?
The first form can be made to work, by adding a deduction guide: template <typename… Ts> struct debug { debug(Ts&&… ts, const std::source_location& loc = std::source_location::current()); }; template <typename… Ts> debug(Ts&&…) -> debug<Ts…>; Test: int main() { debug(5, ‘A’, 3.14f, “foo”); } DEMO