1 // RUN: %clang_cc1 %s -verify -fsyntax-only
4 __attribute__((visibility("hidden"))) __attribute__((aligned
)) class A
; // expected-warning{{attribute 'visibility' is ignored, place it after "class" to apply attribute to type declaration}} \
5 // expected-warning{{attribute 'aligned' is ignored, place it after "class" to apply attribute to type declaration}}
6 __attribute__((visibility("hidden"))) __attribute__((aligned
)) struct B
; // expected-warning{{attribute 'visibility' is ignored, place it after "struct" to apply attribute to type declaration}} \
7 // expected-warning{{attribute 'aligned' is ignored, place it after "struct" to apply attribute to type declaration}}
8 __attribute__((visibility("hidden"))) __attribute__((aligned
)) union C
; // expected-warning{{attribute 'visibility' is ignored, place it after "union" to apply attribute to type declaration}} \
9 // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
10 __attribute__((visibility("hidden"))) __attribute__((aligned
)) enum D
{D
}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
11 // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
12 __attribute__((visibility("hidden"))) __attribute__((aligned
)) enum class EC
{}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
13 // expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
14 __attribute__((visibility("hidden"))) __attribute__((aligned
)) enum struct ES
{}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum struct" to apply attribute to type declaration}} \
15 // expected-warning{{attribute 'aligned' is ignored, place it after "enum struct" to apply attribute to type declaration}}
17 // Test that we get the same warnings for type declarations nested in a record.
19 __attribute__((visibility("hidden"))) __attribute__((aligned
)) class A
; // expected-warning{{attribute 'visibility' is ignored, place it after "class" to apply attribute to type declaration}} \
20 // expected-warning{{attribute 'aligned' is ignored, place it after "class" to apply attribute to type declaration}}
21 __attribute__((visibility("hidden"))) __attribute__((aligned
)) struct B
; // expected-warning{{attribute 'visibility' is ignored, place it after "struct" to apply attribute to type declaration}} \
22 // expected-warning{{attribute 'aligned' is ignored, place it after "struct" to apply attribute to type declaration}}
23 __attribute__((visibility("hidden"))) __attribute__((aligned
)) union C
; // expected-warning{{attribute 'visibility' is ignored, place it after "union" to apply attribute to type declaration}} \
24 // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
25 __attribute__((visibility("hidden"))) __attribute__((aligned
)) enum D
{D
}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
26 // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
27 __attribute__((visibility("hidden"))) __attribute__((aligned
)) enum class EC
{}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
28 // expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
29 __attribute__((visibility("hidden"))) __attribute__((aligned
)) enum struct ES
{}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum struct" to apply attribute to type declaration}} \
30 // expected-warning{{attribute 'aligned' is ignored, place it after "enum struct" to apply attribute to type declaration}}
32 // Also test [[]] attribute syntax. (On a non-nested declaration, these
33 // generate a hard "misplaced attributes" error, which we test for
35 [[gnu::visibility("hidden")]] [[gnu::aligned
]] class E
; // expected-warning{{attribute 'visibility' is ignored, place it after "class" to apply attribute to type declaration}} \
36 // expected-warning{{attribute 'aligned' is ignored, place it after "class" to apply attribute to type declaration}}
37 [[gnu::visibility("hidden")]] [[gnu::aligned
]] struct F
; // expected-warning{{attribute 'visibility' is ignored, place it after "struct" to apply attribute to type declaration}} \
38 // expected-warning{{attribute 'aligned' is ignored, place it after "struct" to apply attribute to type declaration}}
39 [[gnu::visibility("hidden")]] [[gnu::aligned
]] union G
; // expected-warning{{attribute 'visibility' is ignored, place it after "union" to apply attribute to type declaration}} \
40 // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}}
41 [[gnu::visibility("hidden")]] [[gnu::aligned
]] enum H
{H
}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \
42 // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}}
43 [[gnu::visibility("hidden")]] [[gnu::aligned
]] enum class I
{}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \
44 // expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}}
45 [[gnu::visibility("hidden")]] [[gnu::aligned
]] enum struct J
{}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum struct" to apply attribute to type declaration}} \
46 // expected-warning{{attribute 'aligned' is ignored, place it after "enum struct" to apply attribute to type declaration}}
51 __attribute__((visibility("hidden"))) __attribute__((aligned
)) class A
{} a
;
52 __attribute__((visibility("hidden"))) __attribute__((aligned
)) struct B
{} b
;
53 __attribute__((visibility("hidden"))) __attribute__((aligned
)) union C
{} c
;
54 __attribute__((visibility("hidden"))) __attribute__((aligned
)) enum D
{D
} d
;
55 __attribute__((visibility("hidden"))) __attribute__((aligned
)) enum class EC
{} ec
;
56 __attribute__((visibility("hidden"))) __attribute__((aligned
)) enum struct ES
{} es
;
59 __attribute__((visibility("hidden"))) __attribute__((aligned
)) class A
{} a
;
60 __attribute__((visibility("hidden"))) __attribute__((aligned
)) struct B
{} b
;
61 __attribute__((visibility("hidden"))) __attribute__((aligned
)) union C
{} c
;
62 __attribute__((visibility("hidden"))) __attribute__((aligned
)) enum D
{D
} d
;
63 __attribute__((visibility("hidden"))) __attribute__((aligned
)) enum class EC
{} ec
;
64 __attribute__((visibility("hidden"))) __attribute__((aligned
)) enum struct ES
{} es
;
66 [[gnu::visibility("hidden")]] [[gnu::aligned
]] class E
{} e
;
67 [[gnu::visibility("hidden")]] [[gnu::aligned
]] struct F
{} f
;
68 [[gnu::visibility("hidden")]] [[gnu::aligned
]] union G
{} g
;
69 [[gnu::visibility("hidden")]] [[gnu::aligned
]] enum H
{H
} h
;
70 [[gnu::visibility("hidden")]] [[gnu::aligned
]] enum class I
{} i
;
71 [[gnu::visibility("hidden")]] [[gnu::aligned
]] enum struct J
{} j
;