1 // RUN: rm -rf %t
2 // RUN: mkdir -p %t
3 // RUN: split-file %s %t
4 // RUN: cd %t
5 //
6 // RUN: %clang_cc1 -std=c++20 M.cpp -fsyntax-only -DTEST_INTERFACE -verify
7 // RUN: %clang_cc1 -std=c++20 M.cpp -emit-module-interface -o M.pcm
8 // RUN: %clang_cc1 -std=c++20 useM.cpp -fsyntax-only -fmodule-file=M.pcm -verify
9 
10 //--- decls.h
11 int f(); // #1, attached to the global module
12 int g(); // #2, attached to the global module
13 
14 //--- M.cpp
15 module;
16 #include "decls.h"
17 export module M;
18 export using ::f; // OK, does not declare an entity, exports #1
19 #if TEST_INTERFACE
20 // error: matches #2, but attached to M
21 int g(); // expected-error {{declaration of 'g' in module M follows declaration in the global module}}
22 // [email protected]:2 {{previous declaration is here}}
23 #endif
24 export int h(); // #3
25 export int k(); // #4
26 
27 //--- useM.cpp
28 import M;
29 // error: matches #3
30 static int h(); // expected-error {{static declaration of 'h' follows non-static declaration}}
31 // [email protected]:10 {{previous declaration is here}}
32 
33 // error: matches #4
34 int k(); // expected-error {{declaration of 'k' in the global module follows declaration in module M}}
35 // [email protected]:11 {{previous declaration is here}}
36