Issue |
73521
|
Summary |
[libcxxabi][ItaniumDemangle] Mangling produced by clang for lambdas with template parameters fail to demangle
|
Labels |
clang,
libc++,
libc++abi
|
Assignees |
|
Reporter |
Michael137
|
Take this example:
```
int main() {
auto foo = [](auto) -> int {
return 50;
};
foo(50);
}
```
With top-of-tree clang this mangles to: `_ZZ4mainENK3$_0clIiEEiT_` which the `llvm-cxxfilt` fails to demangle. Stepping through the code, the failure occurs in `parseTemplateParam` (when parsing `T_` at the end).
The problem was introduced in the (de)mangler changes in https://reviews.llvm.org/D147655. Specifically, it added a [`SaveTemplateParams` to `parseLocalName`](https://github.com/llvm/llvm-project/blob/79b03306af5c11d354fa90db8bfd7818cd811ef5/libcxxabi/src/demangle/ItaniumDemangle.h#L2951-L2953), which resets the `TemplateParams` when we're done parsing the name. This trips up `parseTemplateParam`.
GCC mangles the above to `_ZZ4mainENKUlT_E_clIiEEiS_`, which demangles fine. The difference here is that GCC mangles the name as a `<lambda-sig>` (i.e., `Ul`), whereas clang mangles the lambda as an unnamed struct with internal linkage. The difference between a local unnamed struct and a lambda is that lambdas can have template parameters. Maybe this difference was looked over in `D147655`?
@zygoloid @urnathan
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs