
Close https://github.com/llvm/llvm-project/issues/102721 Generally, the type of merged decls will be reused in ASTContext. But for lambda, in the import and then include case, we can't decide its previous decl in the imported modules so that we can't assign the previous decl before creating the type for it. Since we can't decide its numbering before creating it. So we have to assign the previous decl and the canonical type for it after creating it, which is unusual and slightly hack.
34 lines
633 B
C++
34 lines
633 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 -emit-module-interface -o %t/b.pcm \
|
|
// RUN: -fprebuilt-module-path=%t
|
|
// RUN: %clang_cc1 -std=c++20 %t/test.cc -fsyntax-only -verify \
|
|
// RUN: -fprebuilt-module-path=%t
|
|
|
|
//--- foo.h
|
|
inline auto x = []{};
|
|
|
|
//--- a.cppm
|
|
module;
|
|
#include "foo.h"
|
|
export module a;
|
|
export using ::x;
|
|
|
|
//--- b.cppm
|
|
module;
|
|
import a;
|
|
#include "foo.h"
|
|
export module b;
|
|
export using ::x;
|
|
|
|
//--- test.cc
|
|
// expected-no-diagnostics
|
|
import a;
|
|
import b;
|
|
void test() {
|
|
x();
|
|
}
|