llvm-project/clang/test/Modules/lambda-in-module-purview-2.cppm
Chuanqi Xu 6345b009c3 [C++20] [Modules] Add mangling number for lambda in non-internal module unit context
Close https://github.com/llvm/llvm-project/issues/59513
Close https://github.com/llvm/llvm-project/issues/110146

As we discussed, this is related to ABI:
https://github.com/itanium-cxx-abi/cxx-abi/issues/186

I was intending to fix this after it gets merged into the ItaniumC++ABI
formally. But it looks like ItaniumC++ABI doesn't update it yet and
there are more issue reports for it.

Luckily Richard had a clear direction guide here though. So I think it
should be good to do this without a formal ItaniumC++ABI wording.

The diff of the patch is slightly larger than it was by a simple
refacoration to simple the control flow a little bit.
2025-03-13 15:04:06 +08:00

23 lines
441 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/use.cpp -fmodule-file=a=%t/a.pcm -fsyntax-only -verify
//--- lambda.h
auto cmp = [](auto l, auto r) {
return l < r;
};
//--- a.cppm
module;
#include "lambda.h"
export module a;
export using ::cmp;
//--- use.cpp
// expected-no-diagnostics
import a;
auto x = cmp;