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
8 // expected-note@* 0+{{declared here}}
13 bool foobool(int argc
) {
19 template <class T
, typename S
, int N
, int ST
>
20 T
tmain(T argc
, S
**argv
) {
23 #pragma omp distribute parallel for simd simdlen // expected-error {{expected '(' after 'simdlen'}}
24 for (int i
= ST
; i
< N
; i
++)
25 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
29 #pragma omp distribute parallel for simd simdlen ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
30 for (int i
= ST
; i
< N
; i
++)
31 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
35 #pragma omp distribute parallel for simd simdlen () // expected-error {{expected expression}}
36 for (int i
= ST
; i
< N
; i
++)
37 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
39 // expected-error@+4 {{expected ')'}} expected-note@+4 {{to match this '('}}
40 // expected-error@+3 2 {{integral constant expression}} expected-note@+3 0+{{constant expression}}
43 #pragma omp distribute parallel for simd simdlen (argc
44 for (int i
= ST
; i
< N
; i
++)
45 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
47 // expected-error@+3 {{argument to 'simdlen' clause must be a strictly positive integer value}}
50 #pragma omp distribute parallel for simd simdlen (ST // expected-error {{expected ')'}} expected-note {{to match this '('}}
51 for (int i
= ST
; i
< N
; i
++)
52 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
56 #pragma omp distribute parallel for simd simdlen (1)) // expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}}
57 for (int i
= ST
; i
< N
; i
++)
58 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
62 #pragma omp distribute parallel for simd simdlen ((ST > 0) ? 1 + ST : 2)
63 for (int i
= ST
; i
< N
; i
++)
64 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
68 // expected-error@+3 2 {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'simdlen' clause}}
69 // expected-error@+2 {{argument to 'simdlen' clause must be a strictly positive integer value}}
70 // expected-error@+1 2 {{integral constant expression}} expected-note@+1 0+{{constant expression}}
71 #pragma omp distribute parallel for simd simdlen (foobool(argc)), simdlen (true), simdlen (-5)
72 for (int i
= ST
; i
< N
; i
++)
73 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
77 #pragma omp distribute parallel for simd simdlen (S) // expected-error {{'S' does not refer to a value}}
78 for (int i
= ST
; i
< N
; i
++)
79 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
81 #if __cplusplus <= 199711L
82 // expected-error@+6 2 {{integral constant expression}} expected-note@+6 0+{{constant expression}}
84 // expected-error@+4 2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
88 #pragma omp distribute parallel for simd simdlen (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
89 for (int i
= ST
; i
< N
; i
++)
90 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
94 #pragma omp distribute parallel for simd simdlen (4)
95 for (int i
= ST
; i
< N
; i
++)
96 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
100 #pragma omp distribute parallel for simd simdlen (N) // expected-error {{argument to 'simdlen' clause must be a strictly positive integer value}}
101 for (T i
= ST
; i
< N
; i
++)
102 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
107 int main(int argc
, char **argv
) {
110 #pragma omp distribute parallel for simd simdlen // expected-error {{expected '(' after 'simdlen'}}
111 for (int i
= 4; i
< 12; i
++)
112 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
116 #pragma omp distribute parallel for simd simdlen ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
117 for (int i
= 4; i
< 12; i
++)
118 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
122 #pragma omp distribute parallel for simd simdlen () // expected-error {{expected expression}}
123 for (int i
= 4; i
< 12; i
++)
124 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
128 #pragma omp distribute parallel for simd simdlen (4 // expected-error {{expected ')'}} expected-note {{to match this '('}}
129 for (int i
= 4; i
< 12; i
++)
130 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
134 #pragma omp distribute parallel for simd simdlen (2+2)) // expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}}
135 for (int i
= 4; i
< 12; i
++)
136 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
140 #pragma omp distribute parallel for simd simdlen (foobool(1) > 0 ? 1 : 2) // expected-error {{integral constant expression}} expected-note 0+{{constant expression}}
141 for (int i
= 4; i
< 12; i
++)
142 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
146 // expected-error@+3 {{integral constant expression}} expected-note@+3 0+{{constant expression}}
147 // expected-error@+2 2 {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'simdlen' clause}}
148 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
149 #pragma omp distribute parallel for simd simdlen (foobool(argc)), simdlen (true), simdlen (-5)
150 for (int i
= 4; i
< 12; i
++)
151 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
155 #pragma omp distribute parallel for simd simdlen (S1) // expected-error {{'S1' does not refer to a value}}
156 for (int i
= 4; i
< 12; i
++)
157 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
159 #if __cplusplus <= 199711L
160 // expected-error@+6 {{integral constant expression}} expected-note@+6 0+{{constant expression}}
162 // expected-error@+4 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
166 #pragma omp distribute parallel for simd simdlen (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
167 for (int i
= 4; i
< 12; i
++)
168 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
172 #pragma omp distribute parallel for simd simdlen(simdlen(tmain<int, char, -1, -2>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}} expected-note {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}}
173 foo(); // expected-error {{statement after '#pragma omp distribute parallel for simd' must be a for loop}}
175 // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 12, 4>' requested here}}
176 return tmain
<int, char, 12, 4>(argc
, argv
);