[clang] [clang-tools-extra] [libcxx] [clang] improved preservation of template keyword (PR #133610)

Jorge Gorbe Moya via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 8 11:27:46 PDT 2025


slackito wrote:

I have a reduced test case for the mangling issue mentioned [here](https://github.com/llvm/llvm-project/pull/133610#issuecomment-2784039483). It's still a bit long (118 lines), so apologies for that.

[hash_mangling.txt](https://github.com/user-attachments/files/19654889/hash_mangling.txt)

Rename the attached file to `hash_mangling.ii` (github wouldn't let me attach it with a .ii extension), then build with `clang++ -c hash_mangling.ii`. With an affected version of `clang` (just checked at HEAD) the resulting object file contains the wrong mangled name:
```
$ llvm-readelf -s -W hash_mangling.o | grep hashable
    33: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT   UND _ZN4absl18container_internal13AbslHashValueINS_13hash_internal15MixingHashStateEEEN12_GLOBAL__N_19enable_ifIXsrNT_S6_11is_hashableIiEE5valueES6_E4typeES6_NS0_12raw_hash_setINS0_17FlatHashSetPolicyEiEE
```
(note the spurious `S6_` mentioned in the comment above)

With a good version of clang, the output looks like this instead
```
    33: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT   UND _ZN4absl18container_internal13AbslHashValueINS_13hash_internal15MixingHashStateEEEN12_GLOBAL__N_19enable_ifIXsrNT_11is_hashableIiEE5valueES6_E4typeES6_NS0_12raw_hash_setINS0_17FlatHashSetPolicyEiEE
```

https://github.com/llvm/llvm-project/pull/133610


More information about the cfe-commits mailing list