llvm/llvm-project

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

Open

#174,064 opened on 2025年12月31日

GitHub で見る
 (7 comments) (0 reactions) (0 assignees)C++ (10,782 forks)batch import
ABIclang:moduleshelp wantedplatform:windows

Repository metrics

Stars
 (26,378 stars)
PR merge metrics
 (平均マージ 1d 2h) (30d で 1,000 merged PRs)

説明

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

コントリビューターガイド