llvm-project/clang/test/Modules/pr137533.cppm
Chuanqi Xu c6cccbfe08 [NFC] [C++20] [Modules] Add test for issue 137533
Close https://github.com/llvm/llvm-project/issues/137533

This may be fixed by other PR before. Adding a test for avoid further regression.
2025-12-19 16:08:05 +08:00

26 lines
672 B
C++

// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 %t/m.cppm -emit-module-interface -o %t/m.pcm
// RUN: %clang_cc1 -std=c++20 %t/use.cpp -fmodule-file=m=%t/m.pcm -fsyntax-only -verify
//
// RUN: %clang_cc1 -std=c++20 %t/m.cppm -emit-reduced-module-interface -o %t/m.pcm
// RUN: %clang_cc1 -std=c++20 %t/use.cpp -fmodule-file=m=%t/m.pcm -fsyntax-only -verify
//--- m.cppm
export module m;
static const char * f() { return "m.cppm"; }
export auto &fr = f;
//--- use.cpp
// expected-no-diagnostics
import m;
static const char * f() { return "use.cpp"; }
constexpr auto &fr1 = f;
auto &fr2 = fr;
int main() {
fr1();
fr2();
}