[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / SemaCXX / init-priority-attr.cpp
blob8c0a17682bb02ae0d9705335c04d488fd88bd8d4
1 // RUN: %clang_cc1 -triple=x86_64-unknown-unknown -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -triple=x86_64-unknown-unknown -fsyntax-only -DSYSTEM -verify %s
3 // RUN: %clang_cc1 -triple=s390x-none-zos -fsyntax-only -verify=unknown %s
4 // RUN: %clang_cc1 -triple=s390x-none-zos -fsyntax-only -DSYSTEM -verify=unknown-system %s
6 #if defined(SYSTEM)
7 #5 "init-priority-attr.cpp" 3 // system header
8 #endif
10 class Two {
11 private:
12 int i, j, k;
13 public:
14 static int count;
15 Two( int ii, int jj ) { i = ii; j = jj; k = count++; };
16 Two( void ) { i = 0; j = 0; k = count++; };
17 int eye( void ) { return i; };
18 int jay( void ) { return j; };
19 int kay( void ) { return k; };
22 extern Two foo;
23 extern Two goo;
24 extern Two coo[];
25 extern Two koo[];
27 Two foo __attribute__((init_priority(101))) ( 5, 6 );
28 // unknown-system-no-diagnostics
29 // unknown-warning@-2 {{unknown attribute 'init_priority' ignored}}
31 Two goo __attribute__((init_priority(2,3))) ( 5, 6 ); // expected-error {{'init_priority' attribute takes one argument}}
32 // unknown-warning@-1 {{unknown attribute 'init_priority' ignored}}
34 Two coo[2] __attribute__((init_priority(100)));
35 #if !defined(SYSTEM)
36 // expected-error@-2 {{'init_priority' attribute requires integer constant between 101 and 65535 inclusive}}
37 // unknown-warning@-3 {{unknown attribute 'init_priority' ignored}}
38 #endif
40 Two boo[2] __attribute__((init_priority(65536)));
41 #if !defined(SYSTEM)
42 // expected-error@-2 {{'init_priority' attribute requires integer constant between 101 and 65535 inclusive}}
43 // unknown-warning@-3 {{unknown attribute 'init_priority' ignored}}
44 #endif
46 Two koo[4] __attribute__((init_priority(1.13))); // expected-error {{'init_priority' attribute requires an integer constant}}
47 // unknown-warning@-1 {{unknown attribute 'init_priority' ignored}}
49 Two func() __attribute__((init_priority(1001))); // expected-error {{'init_priority' attribute only applies to variables}}
50 // unknown-warning@-1 {{unknown attribute 'init_priority' ignored}}
53 int i __attribute__((init_priority(1001))); // expected-error {{can only use 'init_priority' attribute on file-scope definitions of objects of class type}}
54 // unknown-warning@-1 {{unknown attribute 'init_priority' ignored}}
56 int main() {
57 Two foo __attribute__((init_priority(1001))); // expected-error {{can only use 'init_priority' attribute on file-scope definitions of objects of class type}}
58 // unknown-warning@-1 {{unknown attribute 'init_priority' ignored}}