Debian Codegraph @

clang/test/Modules/pr90259.cppm

raw
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/mod1.cppm -emit-reduced-module-interface -o %t/mod-mod1.pcm
6 // RUN: %clang_cc1 -std=c++20 %t/mod.cppm -fprebuilt-module-path=%t \
7 // RUN: -emit-reduced-module-interface -o %t/mod.pcm
8 // RUN: %clang_cc1 -std=c++20 %t/use.cpp -fprebuilt-module-path=%t -verify -fsyntax-only
9
10 //--- mod1.cppm
11 export module mod:mod1;
12 namespace {
13 int abc = 43;
14 }
15 namespace mod {
16 static int def = 44;
17 }
18 export int f() {
19 return abc + mod::def;
20 }
21
22 //--- mod.cppm
23 // expected-no-diagnostics
24 export module mod;
25 import :mod1;
26
27 namespace {
28 double abc = 43.0;
29 }
30
31 namespace mod {
32 static double def = 44.0;
33 }
34
35 export double func() {
36 return (double)f() + abc + mod::def;
37 }
38
39 //--- use.cpp
40 // expected-no-diagnostics
41 import mod;
42 double use() {
43 return func();
44 }