Disable consteval on Apple clang 21#4703
Conversation
Fixes #3785. the write_console symbol has changed from 10.1 to 10.2. Here we restore the symbol as introduced in 10.1.
|
We can possibly give reason or some explanation as to why the PR has been closed. Helps a lot towards getting more context. Thanks ! |
|
We're hitting the same issue in a React Native / Expo project building with Xcode 16 (Apple clang 16, not quite clang 21 but the same failure mode). The errors are identical — We worked around it by patching The approach in this PR (adding a new threshold for clang 21+) seems like the cleaner upstream fix. Would the maintainers consider reopening or a follow-up PR? The workaround burden is falling on every downstream project that builds fmt via CocoaPods with a recent Xcode. |
|
The error "not a constant expression" usually indicates that the format string is invalid. You'll need to provide a repro to demonstrate that there is an actual issue with consteval in clang (which is unlikely). |
Summary
Disable the
FMT_CONSTEVALpath on Apple clang 21.Context
While building Transit's vendored copy of
fmtwith Xcode 26.4 beta 2 (Apple clang 21.0.0 / clang-2100.0.121.2), clang rejects severalFMT_STRING(...)call sites with errors like:The first failure I hit was in
format-inl.hwhile compiling a downstream translation unit that includesfmt/core.h.Change
This introduces
FMT_USE_CONSTEVALand disables it for Apple clang 21+, leaving the existingFMT_CONSTEVALpath unchanged for other toolchains.Verification
Built the affected downstream target successfully after this change:
xcodebuild -project Submodules/transitLib/xcode_build/transitLib.xcodeproj \ -scheme bgtfs \ -destination 'generic/platform=iOS Simulator' \ build