[all-commits] [llvm/llvm-project] 7205d7: [clang][ItaniumMangle] Fix mangling of lambdas in ...

Kristina Bessonova via All-commits all-commits at lists.llvm.org
Wed Jul 8 04:37:05 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7205d7c676c8f90a0cf89484c1a9687fa601b867
      https://github.com/llvm/llvm-project/commit/7205d7c676c8f90a0cf89484c1a9687fa601b867
  Author: Kristina Bessonova <ch.bessonova at gmail.com>
  Date:   2026-07-08 (Wed, 08 Jul 2026)

  Changed paths:
    M clang/docs/ReleaseNotes.md
    M clang/include/clang/Basic/ABIVersions.def
    M clang/lib/AST/ItaniumMangle.cpp
    M clang/test/CodeGenCXX/dtor-local-lambda-mangle.cpp
    M clang/test/CodeGenCXX/mangle-lambdas-gh88906.cpp
    A clang/test/CodeGenCXX/mangle-lambdas-in-dmi-local-class.cpp

  Log Message:
  -----------
  [clang][ItaniumMangle] Fix mangling of lambdas in default member initializers of local classes (#206740)

Lambdas appearing in default member initializers of members of local
classes were previously mangled as if they belonged only to the class
scope, ignoring the enclosing function-local context.

This caused different (but same-named) local classes to produce
identical closure type mangling and corresponding RTTI/IR collisions.

Consider the following example:
```
  void foo() {
    {
      struct T {
        std::function<void()> a = [](){ std::cout << "a"; };
      } t;
      t.a();
    }
    {
      struct T {
        std::function<void()> a = [](){ std::cout << "b"; };
      } t;
      t.a();
    }
  }
```

The expected output is `ab` (and GCC-compiled code behaves accordingly),
while clang previously printed `bb` because the first `T::a` definition
is overridden by the second one due to the missing `<local-name>`
encoding and discriminator required to distinguish the two local `T`
definitions.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list