Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / module / module.interface / p5.cpp
bloba76be594e19d2a4192d8ade88fa69c1df1057c6c
1 // RUN: %clang_cc1 -std=c++2a %s -verify -pedantic-errors
3 export module p5;
5 int a; // expected-note {{target}}
6 static int sa; // expected-note {{target}}
7 void b(); // expected-note {{target}}
8 static void sb(); // expected-note {{target}}
9 struct c {}; // expected-note {{target}}
10 enum d {}; // expected-note {{target}}
11 using e = int;
12 using f = c;
13 static union { int sg1, sg2; }; // expected-note {{target}}
14 namespace NS {}
16 template<typename> int ta; // expected-note {{target}}
17 template<typename> static int sta; // expected-note {{target}}
18 template<typename> void tb(); // expected-note {{target}}
19 template<typename> static void stb(); // expected-note {{target}}
20 template<typename> struct tc {}; // expected-note {{target}}
21 template<typename> using te = int; // expected-note {{target}}
22 template<typename> using tf = c; // expected-note {{target}}
24 namespace UnnamedNS {
25 namespace {
26 int a; // expected-note {{target}}
27 static int sa; // expected-note {{target}}
28 void b(); // expected-note {{target}}
29 static void sb(); // expected-note {{target}}
30 struct c {}; // expected-note {{target}}
31 enum d {}; // expected-note {{target}}
32 using e = int;
33 using f = c;
34 static union { int sg1, sg2; }; // expected-note {{target}}
35 namespace NS {}
37 template<typename> int ta; // expected-note {{target}}
38 template<typename> static int sta; // expected-note {{target}}
39 template<typename> void tb(); // expected-note {{target}}
40 template<typename> static void stb(); // expected-note {{target}}
41 template<typename> struct tc {}; // expected-note {{target}}
42 template<typename> using te = int; // expected-note {{target}}
43 template<typename> using tf = c; // expected-note {{target}}
47 export { // expected-note 28{{here}}
48 using ::a; // expected-error {{using declaration referring to 'a' with module linkage cannot be exported}}
49 using ::sa; // expected-error {{using declaration referring to 'sa' with internal linkage}}
50 using ::b; // expected-error {{using declaration referring to 'b' with module linkage cannot be exported}}
51 using ::sb; // expected-error {{using declaration referring to 'sb' with internal linkage}}
52 using ::c; // expected-error {{using declaration referring to 'c' with module linkage cannot be exported}}
53 using ::d; // expected-error {{using declaration referring to 'd' with module linkage cannot be exported}}
54 using ::e;
55 using ::f;
56 using ::sg1; // expected-error {{using declaration referring to 'sg1' with internal linkage}}
58 using ::ta; // expected-error {{using declaration referring to 'ta' with module linkage cannot be exported}}
59 using ::sta; // expected-error {{using declaration referring to 'sta' with internal linkage}}
60 using ::tb; // expected-error {{using declaration referring to 'tb' with module linkage cannot be exported}}
61 using ::stb; // expected-error {{using declaration referring to 'stb' with internal linkage}}
62 using ::tc; // expected-error {{using declaration referring to 'tc' with module linkage cannot be exported}}
63 using ::te; // expected-error {{using declaration referring to 'te' with module linkage cannot be exported}}
64 using ::tf; // expected-error {{using declaration referring to 'tf' with module linkage cannot be exported}}
65 namespace NS2 = ::NS;
67 namespace UnnamedNS {
68 using UnnamedNS::a; // expected-error {{internal linkage}}
69 using UnnamedNS::sa; // expected-error {{internal linkage}}
70 using UnnamedNS::b; // expected-error {{internal linkage}}
71 using UnnamedNS::sb; // expected-error {{internal linkage}}
72 using UnnamedNS::c; // expected-error {{internal linkage}}
73 using UnnamedNS::d; // expected-error {{internal linkage}}
74 using UnnamedNS::e; // ok
75 using UnnamedNS::f; // ok? using-declaration refers to alias-declaration,
76 // which does not have linkage (even though that then
77 // refers to a type that has internal linkage)
78 using UnnamedNS::sg1; // expected-error {{internal linkage}}
80 using UnnamedNS::ta; // expected-error {{internal linkage}}
81 using UnnamedNS::sta; // expected-error {{internal linkage}}
82 using UnnamedNS::tb; // expected-error {{internal linkage}}
83 using UnnamedNS::stb; // expected-error {{internal linkage}}
84 using UnnamedNS::tc; // expected-error {{internal linkage}}
85 using UnnamedNS::te; // expected-error {{internal linkage}}
86 using UnnamedNS::tf; // expected-error {{internal linkage}}
87 namespace NS2 = UnnamedNS::NS; // ok (wording bug?)