KTX-Software icon indicating copy to clipboard operation
KTX-Software copied to clipboard

Current version of fmt doesn't compile with Clang 20

Open n0F4x opened this issue 7 months ago • 4 comments

Compiling the project with Clang 20 throws some errors similar to this one:

/.conan2/p/b/ktxe2d82b5ecdfa0/b/src/external/fmt/include/fmt/format-inl.h:61:19: error: call to consteval function 'fmt::basic_format_string<char, fmt::basic_string_view<char> &, const char (&)[3]>::basic_format_string<FMT_COMPILE_STRING, 0>' is not a constant expression
   61 |     format_to(it, FMT_STRING("{}{}"), message, SEP);
      |                   ^
...

n0F4x avatar May 15 '25 19:05 n0F4x

We have successful builds with clang 20 and 21. What language standard are you compiling with? Our builds that use fmt{} default to c++17. I suspect you are trying something more recent and that, rather than clang, is the issue.

MarkCallow avatar May 22 '25 05:05 MarkCallow

I compiled with C++26.

n0F4x avatar May 22 '25 10:05 n0F4x

I think this should be the related issue.

n0F4x avatar May 22 '25 10:05 n0F4x

hello, I have this problem too. I compiled it with C++20、C++26 with clang-20 in conan,and it always generate error:

: error: call to consteval function 'fmt::basic_format_string<char, const char (&)[7], int &>::basic_format_string<FMT_COMPILE_STRING, 0>' is not a constant expression
   62 |   format_to(it, FMT_STRING("{}{}"), ERROR_STR, error_code);
      |                 ^

my conan configuration is:

[settings]
arch=x86_64
build_type=Release
compiler=clang
compiler.cppstd=gnu26
compiler.libcxx=libstdc++11
compiler.version=20
os=Linux

[conf]
tools.build:compiler_executables={'c': '/bin/clang-20', 'cpp': '/bin/clang++-20'}

120MF avatar May 25 '25 06:05 120MF

Should be fixed by PR #1056.

MarkCallow avatar Sep 06 '25 07:09 MarkCallow