blob: ba8113582508809b65ae214dee990a845843a2f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
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
|