38 lines · cpp
1// RUN: rm -rf %t2// RUN: mkdir -p %t3// RUN: split-file %s %t4// RUN: cd %t5//6// RUN: %clang_cc1 -std=c++20 M.cpp -fsyntax-only -DTEST_INTERFACE -verify7// RUN: %clang_cc1 -std=c++20 M.cpp -emit-module-interface -o M.pcm8// RUN: %clang_cc1 -std=c++20 M.cpp -emit-reduced-module-interface -o M.reduced.pcm9// RUN: %clang_cc1 -std=c++20 useM.cpp -fsyntax-only -fmodule-file=M=M.pcm -verify10// RUN: %clang_cc1 -std=c++20 useM.cpp -fsyntax-only -fmodule-file=M=M.reduced.pcm -verify11 12//--- decls.h13int f(); // #1, attached to the global module14int g(); // #2, attached to the global module15 16//--- M.cpp17module;18#include "decls.h"19export module M;20export using ::f; // OK, does not declare an entity, exports #121#if TEST_INTERFACE22// error: matches #2, but attached to M23int 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#endif26export int h(); // #327export int k(); // #428 29//--- useM.cpp30import M;31// error: matches #332static 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 #436int 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