diff --git a/include/fmt/compile.h b/include/fmt/compile.h index 94a30b10..d231c83e 100644 --- a/include/fmt/compile.h +++ b/include/fmt/compile.h @@ -532,7 +532,7 @@ template struct code_unit { } }; -// This ensures that the argument type is convertile to `const T&`. +// This ensures that the argument type is convertible to `const T&`. template constexpr const T& get_arg_checked(const Args&... args) { const auto& arg = get(args...); @@ -552,8 +552,7 @@ template struct field { template constexpr OutputIt format(OutputIt out, const Args&... args) const { - const T& arg = get_arg_checked(args...); - return write(out, arg); + return write(out, get_arg_checked(args...)); } }; @@ -599,11 +598,10 @@ template struct spec_field { template constexpr OutputIt format(OutputIt out, const Args&... args) const { - const T& arg = get_arg_checked(args...); const auto& vargs = make_format_args>(args...); basic_format_context ctx(out, vargs); - return fmt.format(arg, ctx); + return fmt.format(get_arg_checked(args...), ctx); } };