llvm / llvm/llvm-project

[clang] Incorrect Microsoft mangling with auto and template type parameter

Open
#203,431 1 comment 0 reactions 0 assignees View on GitHub
clang:frontend platform:windows
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

```c++
int z(int);
template
auto f() -> auto(*)(T) {
return z;
}
void g() { f();}
```

MSVC mangles this as `??$f@H@@YAP6A?A_PH@ZXZ`. clang produces `??$f@H@@YAP6A?A_P?@@ZXZ`. (Note the `` mangling is the fictitious mangling from #117845. CC @MaxEW707 .)

Possibly related to #203278 .

Contributor guide

Open the contributing guide

Research direction

Start by compiling the provided C++ reproducer with Clang and comparing its Microsoft mangled name with the MSVC result. Trace Clang's Microsoft name-mangling handling for the dependent function-pointer return type, considering the related issue #203278. Done means the reproducer emits the expected MSVC mangling without the fictitious template-parameter encoding.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.