| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: mkdir -p %t |
| 3 |
// RUN: split-file %s %t |
| 4 |
// |
| 5 |
// RUN: %clang_cc1 -std=c++20 %t/m.cppm -emit-module-interface -o %t/m.pcm |
| 6 |
// RUN: %clang_cc1 -std=c++20 %t/use.cpp -fmodule-file=m=%t/m.pcm -fsyntax-only -verify |
| 7 |
// |
| 8 |
// RUN: %clang_cc1 -std=c++20 %t/m.cppm -emit-reduced-module-interface -o %t/m.pcm |
| 9 |
// RUN: %clang_cc1 -std=c++20 %t/use.cpp -fmodule-file=m=%t/m.pcm -fsyntax-only -verify |
| 10 |
|
| 11 |
//--- m.cppm |
| 12 |
export module m; |
| 13 |
static const char * f() { return "m.cppm"; } |
| 14 |
export auto &fr = f; |
| 15 |
|
| 16 |
//--- use.cpp |
| 17 |
// expected-no-diagnostics |
| 18 |
import m; |
| 19 |
static const char * f() { return "use.cpp"; } |
| 20 |
constexpr auto &fr1 = f; |
| 21 |
auto &fr2 = fr; |
| 22 |
int main() { |
| 23 |
fr1(); |
| 24 |
fr2(); |
| 25 |
} |