blob: c4299dc04fb4b2782c2e74974c65be87ba03557d [file] [log] [blame]
Richard Smithe181de72019-04-22 22:50:11 +00001// RUN: %clang_cc1 -std=c++2a %s -verify -pedantic-errors
2
3export module p5;
4
5int a;
6static int sa; // expected-note {{target}}
7void b();
8static void sb(); // expected-note {{target}}
9struct c {};
10enum d {};
11using e = int;
12using f = c;
13static union { int sg1, sg2; }; // expected-note {{target}}
14namespace NS {}
15
16template<typename> int ta;
17template<typename> static int sta;
18template<typename> void tb();
19template<typename> static void stb(); // expected-note {{target}}
20template<typename> struct tc {};
21template<typename> using te = int;
22template<typename> using tf = c;
23
24namespace 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 {}
36
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}}
44 }
45}
46
47export { // expected-note 18{{here}}
48 using ::a;
49 using ::sa; // expected-error {{using declaration referring to 'sa' with internal linkage}}
50 using ::b;
51 using ::sb; // expected-error {{using declaration referring to 'sb' with internal linkage}}
52 using ::c;
53 using ::d;
54 using ::e;
55 using ::f;
56 using ::sg1; // expected-error {{using declaration referring to 'sg1' with internal linkage}}
57
58 using ::ta;
59 using ::sta; // FIXME {{using declaration referring to 'sta' with internal linkage}}
60 using ::tb;
61 using ::stb; // expected-error {{using declaration referring to 'stb' with internal linkage}}
62 using ::tc;
63 using ::te;
64 using ::tf;
65 namespace NS2 = ::NS;
66
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}}
79
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?)
88 }
89}