resolves a c++20 compilation error with clang13:
ceph/src/mgr/Mgr.cc:602:42: error: call to consteval function 'fmt::basic_format_string<char, const std::basic_string<char> &>::basic_format_string<const char *, 0>' is not a constant expression
monc->start_mon_command({fmt::format(cmd, name)}, {},
^
ceph/src/fmt/include/fmt/core.h:2839:56: note: read of non-constexpr variable 'cmd' is not allowed in a constant expression
FMT_CONSTEVAL basic_format_string(const S& s) : str_(s) {
^
ceph/src/mgr/Mgr.cc:602:42: note: in call to 'basic_format_string(cmd)'
monc->start_mon_command({fmt::format(cmd, name)}, {},
^
ceph/src/mgr/Mgr.cc:601:17: note: declared here
const char* cmd = R"({{"prefix": "mon metadata", "id": "{}"}})";
^
Signed-off-by: Casey Bodley <cbodley@redhat.com>
continue;
}
auto c = new MetadataUpdate(daemon_state, k);
- const char* cmd = R"({{"prefix": "mon metadata", "id": "{}"}})";
+ constexpr std::string_view cmd = R"({{"prefix": "mon metadata", "id": "{}"}})";
monc->start_mon_command({fmt::format(cmd, name)}, {},
&c->outbl, &c->outs, c);
}