llvm/llvm-project

[C++20] [Modules] Not properly mangling for entities in named modules for MSVC ABI

Open

#174.064 aperta il 31 dic 2025

Vedi su GitHub
 (7 commenti) (0 reazioni) (0 assegnatari)C++ (10.782 fork)batch import
ABIclang:moduleshelp wantedplatform:windows

Metriche repository

Star
 (26.378 star)
Metriche merge PR
 (Merge medio 1g 2h) (1000 PR mergiate in 30 g)

Descrizione

Reproducer: https://godbolt.org/z/5oaM6Yjv5

for

export module a;
export int func() {
    return 43;
}

Clang in Windows ABI generates:

"?func@@YAHXZ"

but MSVC generates:

?func@@YAHXZ::<!a>

This is a compatibility problem. And also this is a correctness problem. Since the design of C++20 Named Modules ask toolchains to treat the entity in different named modules as different entity at link time even they have the same name. So this is a missing feature at ABI level.

Estimated difficulty: medium

Guida contributor