Debian Codegraph @

clang/test/SemaCXX/P1811.cpp

raw
1 // RUN: rm -rf %t
2 // RUN: split-file %s %t
3
4
5 // RUN: %clang_cc1 -std=c++20 -verify -emit-module-interface %t/mod.cpp -o %t/mod.pcm
6 // RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify -fmodule-file=M=%t/mod.pcm %t/main1.cpp
7 // RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify -fmodule-file=M=%t/mod.pcm %t/main2.cpp
8
9 //--- mod.cpp
10 // expected-no-diagnostics
11 module;
12 #include "A.h"
13 export module M;
14 export A f() {return A{};}
15
16 //--- A.h
17 // expected-no-diagnostics
18 #ifndef X
19 #define X
20
21 struct A{};
22
23 #endif
24
25 //--- main1.cpp
26 // expected-no-diagnostics
27 #include "A.h"
28 import M;
29
30 extern "C++" int main() {
31 A a;
32 }
33
34 //--- main2.cpp
35 // expected-no-diagnostics
36 import M;
37 #include "A.h"
38
39 extern "C++" int main() {
40 A a;
41 }