mirror of
https://github.com/gentoo-mirror/guru.git
synced 2025-04-20 23:46:14 -04:00
50 lines
2.1 KiB
Diff
50 lines
2.1 KiB
Diff
From 4a4726c77123f805cff8b954909663eaed296558 Mon Sep 17 00:00:00 2001
|
||
From: Kefu Chai <tchaikov@gmail.com>
|
||
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<std::optional<mtx::http::ClientError> >’ as ‘this’ argument discards qualifiers [-fpermissive]
|
||
1392 | ctx.advance_to(cf.format(*static_cast<qualified_type*>(arg), ctx));
|
||
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||
```
|
||
|
||
so let's mark the `format()` with `const` specifier.
|
||
|
||
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
|
||
---
|
||
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 2d0e7a4..b99ff90 100644
|
||
--- a/include/mtxclient/http/errors.hpp
|
||
+++ b/include/mtxclient/http/errors.hpp
|
||
@@ -87,7 +87,7 @@ struct fmt::formatter<mtx::http::ClientError>
|
||
// Formats the point p using the parsed format specification (presentation)
|
||
// stored in this formatter.
|
||
template<typename FormatContext>
|
||
- 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<std::optional<mtx::http::ClientError>> : formatter<mtx::ht
|
||
{
|
||
// parse is inherited from formatter<string_view>.
|
||
template<typename FormatContext>
|
||
- auto format(std::optional<mtx::http::ClientError> c, FormatContext &ctx)
|
||
+ auto format(std::optional<mtx::http::ClientError> c, FormatContext &ctx) const
|
||
{
|
||
if (!c)
|
||
return fmt::format_to(ctx.out(), "(no error)");
|
||
--
|
||
2.47.1
|
||
|