From f882f51c0500f9a31c5e77b252fee63ab3726f7e Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Thu, 30 Jan 2025 23:16:49 +0100 Subject: Fix log with no arguments --- asl/log/log.hpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'asl') diff --git a/asl/log/log.hpp b/asl/log/log.hpp index a6b8f03..f2e3a47 100644 --- a/asl/log/log.hpp +++ b/asl/log/log.hpp @@ -67,10 +67,17 @@ void log_inner(level l, string_view fmt, span void log(level l, const source_location& sl, string_view fmt, const Args&... args) { - format_internals::type_erased_arg type_erased_args[] = { - format_internals::type_erased_arg(args)... - }; - log_inner(l, fmt, type_erased_args, sl); + if constexpr (sizeof...(Args) == 0) + { + log_inner(l, fmt, {}, sl); + } + else + { + format_internals::type_erased_arg type_erased_args[] = { + format_internals::type_erased_arg(args)... + }; + log_inner(l, fmt, type_erased_args, sl); + } } } // namespace asl::log -- cgit