From 8b4c5a6269e2fa1fd851eeaafda39ed781f2ac34 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Tue, 16 Jan 2024 21:58:55 +0100 Subject: [PATCH] Codechange: compile-time validate the string format of SlErrorCorruptFmt (#11805) --- src/saveload/saveload_error.hpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/saveload/saveload_error.hpp b/src/saveload/saveload_error.hpp index f23a81e32d..1bf3c1556c 100644 --- a/src/saveload/saveload_error.hpp +++ b/src/saveload/saveload_error.hpp @@ -20,15 +20,14 @@ void NORETURN SlErrorCorrupt(const std::string &msg); * Issue an SlErrorCorrupt with a format string. * @param format_string The formatting string to tell what to do with the remaining arguments. * @param fmt_args The arguments to be passed to fmt. - * @tparam T The type of formatting parameter. * @tparam Args The types of the fmt arguments. * @note This function does never return as it throws an exception to * break out of all the saveload code. */ -template -inline void NORETURN SlErrorCorruptFmt(const T &format, Args&&... fmt_args) +template +inline void NORETURN SlErrorCorruptFmt(const fmt::format_string format, Args&&... fmt_args) { - SlErrorCorrupt(fmt::format(format, fmt_args...)); + SlErrorCorrupt(fmt::format(format, std::forward(fmt_args)...)); } #endif /* SAVELOAD_ERROR_HPP */