]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: remove FMT_STRING to fix clang 20+ build failure 66928/head
authorZ. Liu <zhixu.liu@gmail.com>
Wed, 14 Jan 2026 14:46:39 +0000 (22:46 +0800)
committerZ. Liu <zhixu.liu@gmail.com>
Fri, 16 Jan 2026 03:09:12 +0000 (11:09 +0800)
Fix a build failure with Clang 20+ using -std=c++20, where fmt
(v9.1.0, v11.0.0, and possibly other versions) fails to parse
format strings at compile-time in a consteval context. This is
a known issue in fmt, fixed in fmt v11.1.0 (see
https://github.com/fmtlib/fmt/commit/6797f0c39a4ef13061cbc3bb850c35af7428fdc4).

The following error occurs when building rgw_auth_s3.cc:

  src/rgw/rgw_auth_s3.cc:600:22: error: call to consteval function
  'fmt::basic_format_string<...>' is not a constant expression

Removing FMT_STRING avoids compile-time format string parsing
and restores buildability across different toolchains.

Test case:

  #include <fmt/format.h>

  std::string gen_v4_scope(const std::string& region)
  {
    return fmt::format(FMT_STRING("{:s}"), region);
  }

Compile with:

  clang -isystem fmt/include -std=c++20 -c test.cc

Signed-off-by: Z. Liu <zhixu.liu@gmail.com>
src/rgw/rgw_auth_s3.cc

index c14a937685aa99f386c27fb58853b22e926a04de..b31b0279d8e2b14fba232b61e974c9993e523b27 100644 (file)
@@ -605,7 +605,7 @@ string gen_v4_scope(const ceph::real_time& timestamp,
   auto mon = bt.tm_mon + 1;
   auto day = bt.tm_mday;
 
-  return fmt::format(FMT_STRING("{:d}{:02d}{:02d}/{:s}/{:s}/aws4_request"),
+  return fmt::format("{:d}{:02d}{:02d}/{:s}/{:s}/aws4_request",
                      year, mon, day, region, service);
 }