1 // RUN: %clang_cc1 -std=c++2a %s -verify -pedantic-errors 2 3 export module p5; 4 5 int a; 6 static int sa; // expected-note {{target}} 7 void b(); 8 static void sb(); // expected-note {{target}} 9 struct c {}; 10 enum d {}; 11 using e = int; 12 using f = c; 13 static union { int sg1, sg2; }; // expected-note {{target}} 14 namespace NS {} 15 16 template<typename> int ta; 17 template<typename> static int sta; // expected-note {{target}} 18 template<typename> void tb(); 19 template<typename> static void stb(); // expected-note {{target}} 20 template<typename> struct tc {}; 21 template<typename> using te = int; 22 template<typename> using tf = c; 23 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 {} 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 47 export { // expected-note 19{{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; // expected-error {{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 } 90