1 // RUN: %clang_cc1 -std=c++2a %s -verify -pedantic-errors
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}}
13 static union { int sg1
, sg2
; }; // expected-note {{target}}
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}}
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}}
34 static union { int sg1
, sg2
; }; // expected-note {{target}}
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}}
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}}
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?)