[clang] [clang][ItaniumMangle] Fix mangling of lambdas in default member initializers of local classes (PR #206740)
Kristina Bessonova via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 30 09:57:51 PDT 2026
chbessonova wrote:
@erichkeane Thank you for the feedback!
I'll add a release note.
> However, this ALSO needs to have an entry in the -fclang-abi list, this is obviously quite breaking of a change ABI wise.
I've thought about this, but I'm not yet convinced that a new `-fclang-abi-compat` entry is necessary.
The change only affects function-local classes, and while such types can technically escape their function scope, they seems cannot escape the translation unit in a way that would create a ABI compatibility issue. Am I missing something?
As a point of comparison, a similar mangling fix in [PR #195340](https://github.com/llvm/llvm-project/pull/195340) did not introduce a new ABI compatibility entry.
That said, I'm happy to add one, just want to make sure it is actually necessary.
> Does our lambda numbering still work correctly? it isn't clear from your tests.
I'm not intending to change lambda numbering, but I checked it for sure.
This example:
```
void foo() {
{
auto f = [] { std::cout << 1 << '\n'; };
f();
}
{
auto f = [] { std::cout << 2 << '\n'; };
f();
}
}
```
produces a bit unusual mangling, but the numbering itself seems correct and isn't affected by the patch:
```
_ZZ3foovENK3$_0clEv
_ZZ3foovENK3$_1clEv
```
But I'd expect smth like this anyway
```
_ZZ3foovENKUlvE_clEv
_ZZ3foovENKUlvE0_clEv
```
https://github.com/llvm/llvm-project/pull/206740
More information about the cfe-commits
mailing list