llvm / llvm/llvm-project

Name mangling difference between clang and gcc in auto template parameter

Open
#192,841 2 comments 0 reactions 0 assignees View on GitHub
clang:frontend diverges-from:gcc
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Given this code
```cpp
namespace ns {
template
void g();
}

void f() {
ns::g();
}
```
clang produces the mangled symbol
`_ZN2ns1gITnDaXadL_Z1fvEEEEvv` while gcc produces
`_ZN2ns1gIXadL_Z1fvEEEEvv`. Note the extra `TnDa` that clang inserts before the `Xadl_`.
See [godbolt demo](https://gcc.godbolt.org/z/9E87d45MP)
demangler.com and llvm-cxxfilt-21 both demangle either symbol to the same string `void ns::g<&f>()`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.