1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
3 int f() __attribute__((internal_linkage
));
6 class __attribute__((internal_linkage
)) A
{
8 int x
__attribute__((internal_linkage
)); // expected-warning{{'internal_linkage' attribute only applies to variables, functions, and classes}}
9 static int y
__attribute__((internal_linkage
));
10 void f1() __attribute__((internal_linkage
));
11 void f2() __attribute__((internal_linkage
)) {}
12 static void f3() __attribute__((internal_linkage
)) {}
13 void f4(); // expected-note{{previous declaration is here}}
14 static int zz
; // expected-note{{previous declaration is here}}
15 A() __attribute__((internal_linkage
)) {}
16 ~A() __attribute__((internal_linkage
)) {}
17 A
& operator=(const A
&) __attribute__((internal_linkage
)) { return *this; }
19 int z
__attribute__((internal_linkage
)); // expected-warning{{'internal_linkage' attribute only applies to}}
23 __attribute__((internal_linkage
)) void A::f4() {} // expected-error{{'internal_linkage' attribute does not appear on the first declaration}}
25 __attribute__((internal_linkage
)) int A::zz
; // expected-error{{'internal_linkage' attribute does not appear on the first declaration}}
27 namespace Z
__attribute__((internal_linkage
)) { // expected-warning{{'internal_linkage' attribute only applies to}}
30 __attribute__((internal_linkage("foo"))) int g() {} // expected-error{{'internal_linkage' attribute takes no arguments}}
32 [[clang::internal_linkage
]] int h() {}
34 enum struct __attribute__((internal_linkage
)) E
{ // expected-warning{{'internal_linkage' attribute only applies to}}
44 void g(int a
[[clang::internal_linkage
]]) { // expected-warning{{'internal_linkage' attribute only applies to variables, functions and classes}}
45 int x
[[clang::internal_linkage
]]; // expected-warning{{'internal_linkage' attribute on a non-static local variable is ignored}}
46 static int y
[[clang::internal_linkage
]];