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 M.cpp -emit-reduced-module-interface -o M.reduced.pcm 9 // RUN: %clang_cc1 -std=c++20 useM.cpp -fsyntax-only -fmodule-file=M=M.pcm -verify 10 // RUN: %clang_cc1 -std=c++20 useM.cpp -fsyntax-only -fmodule-file=M=M.reduced.pcm -verify 11 12 //--- decls.h 13 int f(); // #1, attached to the global module 14 int g(); // #2, attached to the global module 15 16 //--- M.cpp 17 module; 18 #include "decls.h" 19 export module M; 20 export using ::f; // OK, does not declare an entity, exports #1 21 #if TEST_INTERFACE 22 // error: matches #2, but attached to M 23 int g(); // expected-error {{declaration of 'g' in module M follows declaration in the global module}} 24 // expected-note@decls.h:2 {{previous declaration is here}} 25 #endif 26 export int h(); // #3 27 export int k(); // #4 28 29 //--- useM.cpp 30 import M; 31 // error: matches #3 32 static int h(); // expected-error {{static declaration of 'h' follows non-static declaration}} 33 // expected-note@M.cpp:10 {{previous declaration is here}} 34 35 // error: matches #4 36 int k(); // expected-error {{declaration of 'k' in the global module follows declaration in module M}} 37 // expected-note@M.cpp:11 {{previous declaration is here}} 38