Skip to content

Conversation

FatihBAKIR
Copy link
Contributor

The current implementation assumes whenever we're on an FMT_MSC_VERSION compiler, the standard library is MSVC's STL. However, with clang-cl we have the possibility of using LLVM libc++ instead of MSVC STL. In that scenario, the previous implementation produced the wrong demangled names for RTTI types.

This patch detects the different combinations, and combines the existing demangling implementations to produce the correct names and make all tests pass on libc++ + clang-cl.

Fixes #4542

@FatihBAKIR
Copy link
Contributor Author

@vitaut the lint/format_code task is failing but it also points out a file I did not touch. I also formatted the files locally with clang-format using the .clang-format file in the repo, but it still complains in CI. What's the procedure here? Should I manually apply what the CI wants including the unrelated file?

@vitaut
Copy link
Contributor

vitaut commented Oct 2, 2025

The formatting issue in chrono.h has been fixed in #4557. Please rebase and it should go away.

@vitaut
Copy link
Contributor

vitaut commented Oct 4, 2025

As for the formatting issue in std.h, it might be caused by a different version of clang-format. I suggest applying the change from CI manually:

-auto normalize_msvc_abi_name(string_view abi_name_view,
-                             OutputIt out) -> OutputIt {
+auto normalize_msvc_abi_name(string_view abi_name_view, OutputIt out)
+    -> OutputIt {

The current implementation assumes whenever we're on an FMT_MSC_VERSION
compiler, the standard library is MSVC's STL. However, with clang-cl we
have the possibility of using LLVM libc++ instead of MSVC STL. In that
scenario, the previous implementation produced the wrong demangled names
for RTTI types.

This patch detects the different combinations, and combines the existing
demangling implementations to produce the correct names and make all
tests pass on libc++ + clang-cl.
@vitaut vitaut merged commit 03c7e28 into fmtlib:master Oct 8, 2025
41 checks passed
@vitaut
Copy link
Contributor

vitaut commented Oct 8, 2025

Thank you for the fix!

Comment on lines +142 to +143
string_view normalize_libcxx_inline_namespaces(string_view demangled_name_view,
char* begin) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function should have been inline because it is defined in the header.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, mb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

std-test fails on clang-cl + libc++
2 participants