1 // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
2 // RUN: %clang_cc1 -verify -fopenmp -std=c++98 %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp -std=c++11 %s -Wuninitialized
5 // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
6 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s -Wuninitialized
7 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s -Wuninitialized
9 // expected-note@* 0+{{declared here}}
14 bool foobool(int argc
) {
21 template <class T
, typename S
, int N
, int ST
>
22 T
tmain(T argc
, S
**argv
) {
23 #pragma omp target parallel for ordered
24 for (int i
= ST
; i
< N
; i
++)
25 argv
[0][i
] = argv
[0][i
] - argv
[0][i
- ST
];
26 #pragma omp target parallel for ordered( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
27 for (int i
= ST
; i
< N
; i
++)
28 argv
[0][i
] = argv
[0][i
] - argv
[0][i
- ST
];
29 #pragma omp target parallel for ordered() // expected-error {{expected expression}}
30 for (int i
= ST
; i
< N
; i
++)
31 argv
[0][i
] = argv
[0][i
] - argv
[0][i
- ST
];
32 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
33 // expected-error@+1 2 {{integral constant expression}} expected-note@+1 0+{{constant expression}}
34 #pragma omp target parallel for ordered(argc
35 for (int i
= ST
; i
< N
; i
++)
36 argv
[0][i
] = argv
[0][i
] - argv
[0][i
- ST
];
37 // expected-error@+1 2 {{argument to 'ordered' clause must be a strictly positive integer value}}
38 #pragma omp target parallel for ordered(ST // expected-error {{expected ')'}} expected-note {{to match this '('}}
39 for (int i
= ST
; i
< N
; i
++)
40 argv
[0][i
] = argv
[0][i
] - argv
[0][i
- ST
];
41 #pragma omp target parallel for ordered(1)) // expected-warning {{extra tokens at the end of '#pragma omp target parallel for' are ignored}}
42 for (int i
= ST
; i
< N
; i
++)
43 argv
[0][i
] = argv
[0][i
] - argv
[0][i
- ST
];
44 #pragma omp target parallel for ordered((ST > 0) ? 1 + ST : 2) // expected-note 2 {{as specified in 'ordered' clause}}
45 for (int i
= ST
; i
< N
; i
++)
46 argv
[0][i
] = argv
[0][i
] - argv
[0][i
- ST
]; // expected-error 2 {{expected 2 for loops after '#pragma omp target parallel for', but found only 1}}
48 // expected-error@+3 2 {{directive '#pragma omp target parallel for' cannot contain more than one 'ordered' clause}}
49 // expected-error@+2 {{argument to 'ordered' clause must be a strictly positive integer value}}
50 // expected-error@+1 2 {{integral constant expression}} expected-note@+1 0+{{constant expression}}
51 #pragma omp target parallel for ordered(foobool(argc)), ordered(true), ordered(-5)
52 for (int i
= ST
; i
< N
; i
++)
53 argv
[0][i
] = argv
[0][i
] - argv
[0][i
- ST
];
54 #pragma omp target parallel for ordered(S) // expected-error {{'S' does not refer to a value}}
55 for (int i
= ST
; i
< N
; i
++)
56 argv
[0][i
] = argv
[0][i
] - argv
[0][i
- ST
];
57 #if __cplusplus >= 201103L
58 // expected-error@+4 2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
60 // expected-error@+2 2 {{integral constant expression}} expected-note@+2 0+{{constant expression}}
62 #pragma omp target parallel for ordered(argv[1] = 2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
63 for (int i
= ST
; i
< N
; i
++)
64 argv
[0][i
] = argv
[0][i
] - argv
[0][i
- ST
];
65 #pragma omp target parallel for ordered(1)
66 for (int i
= ST
; i
< N
; i
++)
67 argv
[0][i
] = argv
[0][i
] - argv
[0][i
- ST
];
68 #pragma omp target parallel for ordered(N) // expected-error {{argument to 'ordered' clause must be a strictly positive integer value}}
69 for (T i
= ST
; i
< N
; i
++)
70 argv
[0][i
] = argv
[0][i
] - argv
[0][i
- ST
];
71 #pragma omp target parallel for ordered(2) // expected-note {{as specified in 'ordered' clause}}
72 foo(); // expected-error {{expected 2 for loops after '#pragma omp target parallel for'}}
76 int main(int argc
, char **argv
) {
77 #pragma omp target parallel for ordered
78 for (int i
= 4; i
< 12; i
++)
79 argv
[0][i
] = argv
[0][i
] - argv
[0][i
- 4];
80 #pragma omp target parallel for ordered( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
81 for (int i
= 4; i
< 12; i
++)
82 argv
[0][i
] = argv
[0][i
] - argv
[0][i
- 4];
83 #pragma omp target parallel for ordered() // expected-error {{expected expression}}
84 for (int i
= 4; i
< 12; i
++)
85 argv
[0][i
] = argv
[0][i
] - argv
[0][i
- 4];
86 #pragma omp target parallel for ordered(4 // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{as specified in 'ordered' clause}}
87 for (int i
= 4; i
< 12; i
++)
88 argv
[0][i
] = argv
[0][i
] - argv
[0][i
- 4]; // expected-error {{expected 4 for loops after '#pragma omp target parallel for', but found only 1}}
89 #pragma omp target parallel for ordered(2 + 2)) // expected-warning {{extra tokens at the end of '#pragma omp target parallel for' are ignored}} expected-note {{as specified in 'ordered' clause}}
90 for (int i
= 4; i
< 12; i
++)
91 argv
[0][i
] = argv
[0][i
] - argv
[0][i
- 4]; // expected-error {{expected 4 for loops after '#pragma omp target parallel for', but found only 1}}
93 #pragma omp target parallel for ordered(foobool(1) > 0 ? 1 : 2) // expected-error {{integral constant expression}} expected-note 0+{{constant expression}}
94 for (int i
= 4; i
< 12; i
++)
95 argv
[0][i
] = argv
[0][i
] - argv
[0][i
- 4];
97 // expected-error@+3 {{integral constant expression}} expected-note@+3 0+{{constant expression}}
98 // expected-error@+2 2 {{directive '#pragma omp target parallel for' cannot contain more than one 'ordered' clause}}
99 // expected-error@+1 {{argument to 'ordered' clause must be a strictly positive integer value}}
100 #pragma omp target parallel for ordered(foobool(argc)), ordered(true), ordered(-5)
101 for (int i
= 4; i
< 12; i
++)
102 argv
[0][i
] = argv
[0][i
] - argv
[0][i
- 4];
103 #pragma omp target parallel for ordered(S1) // expected-error {{'S1' does not refer to a value}}
104 for (int i
= 4; i
< 12; i
++)
105 argv
[0][i
] = argv
[0][i
] - argv
[0][i
- 4];
106 #if __cplusplus >= 201103L
107 // expected-error@+4 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
109 // expected-error@+2 {{integral constant expression}} expected-note@+2 0+{{constant expression}}
111 #pragma omp target parallel for ordered(argv[1] = 2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
112 for (int i
= 4; i
< 12; i
++)
113 argv
[0][i
] = argv
[0][i
] - argv
[0][i
- 4];
114 // expected-error@+3 {{statement after '#pragma omp target parallel for' must be a for loop}}
115 // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}}
116 #pragma omp target parallel for ordered(ordered(tmain < int, char, -1, -2 > (argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}}
118 #pragma omp target parallel for ordered(2) // expected-note {{as specified in 'ordered' clause}}
119 foo(); // expected-error {{expected 2 for loops after '#pragma omp target parallel for'}}
120 // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 1, 0>' requested here}}
121 return tmain
<int, char, 1, 0>(argc
, argv
);