Files
llvm-project/clang/test/Modules/lambda-convertablity.cppm
Chuanqi Xu 5937d7f907 [C++20] [Modules] Correct the behavior for adding mangling for lambda in modules
Close https://github.com/llvm/llvm-project/issues/130080
Close https://github.com/llvm/llvm-project/issues/116087

The common pattern of the problem is the lambda is somehow leaked from a
non-inline non-internal function in module purview, and we need to
define a mangling for it by the discuss from
https://github.com/itanium-cxx-abi/cxx-abi/issues/186

The root cause of the issue is a mismatch that give up too quickly when
ManglingContextDecl is nullptr. But we can still get the context
information from DC.
2025-12-19 15:44:34 +08:00

24 lines
609 B
C++

// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-module-interface -o %t/a.pcm
// RUN: %clang_cc1 -std=c++20 %t/B.cppm -fprebuilt-module-path=%t -fsyntax-only -verify
//
// RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-reduced-module-interface -o %t/a.pcm
// RUN: %clang_cc1 -std=c++20 %t/B.cppm -fprebuilt-module-path=%t -fsyntax-only -verify
//--- A.cppm
export module a;
export auto f() {
return [](){};
}
//--- B.cppm
// expected-no-diagnostics
export module b;
import a;
static_assert(__is_convertible_to(decltype(f()), decltype(f())));