llvm/llvm-project

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

开放

#174,064 创建于 2025年12月31日

 (7 条评论) (0 个反应) (0 位负责人)C++ (10,782 个派生)batch import
ABIclang:moduleshelp wantedplatform:windows

仓库指标

星标
 (26,378 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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

贡献者指南