From 4a4726c77123f805cff8b954909663eaed296558 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 15 Jul 2024 11:35:09 +0800 Subject: [PATCH] Fix build with fmt 11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fmt 11 enforces that fmt::formatter<..>::format() should be const. otherwise the tree does not build: ``` /usr/include/fmt/base.h:1392:29: error: passing ‘const fmt::v11::formatter >’ as ‘this’ argument discards qualifiers [-fpermissive] 1392 | ctx.advance_to(cf.format(*static_cast(arg), ctx)); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` so let's mark the `format()` with `const` specifier. Signed-off-by: Kefu Chai --- include/mtxclient/http/errors.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/mtxclient/http/errors.hpp b/include/mtxclient/http/errors.hpp index 2d0e7a45..b99ff90e 100644 --- a/include/mtxclient/http/errors.hpp +++ b/include/mtxclient/http/errors.hpp @@ -87,7 +87,7 @@ struct fmt::formatter // Formats the point p using the parsed format specification (presentation) // stored in this formatter. template - auto format(const mtx::http::ClientError &e, FormatContext &ctx) -> decltype(ctx.out()) + auto format(const mtx::http::ClientError &e, FormatContext &ctx) const -> decltype(ctx.out()) { // ctx.out() is an output iterator to write to. bool prepend_comma = false; @@ -132,7 +132,7 @@ struct fmt::formatter> : formatter. template - auto format(std::optional c, FormatContext &ctx) + auto format(std::optional c, FormatContext &ctx) const { if (!c) return fmt::format_to(ctx.out(), "(no error)");