Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / basic / basic.link / p10-ex2.cpp
blob95fdb56f78d62508627ac9f3302fbd8a74e268f2
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=M.pcm -verify
10 //--- decls.h
11 int f(); // #1, attached to the global module
12 int g(); // #2, attached to the global module
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 // expected-note@decls.h:2 {{previous declaration is here}}
23 #endif
24 export int h(); // #3
25 export int k(); // #4
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 // expected-note@M.cpp:10 {{previous declaration is here}}
33 // error: matches #4
34 int k(); // expected-error {{declaration of 'k' in the global module follows declaration in module M}}
35 // expected-note@M.cpp:11 {{previous declaration is here}}