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
) {
20 template <class T
, typename S
, int N
, int ST
>
21 T
tmain(T argc
, S
**argv
) {
25 #pragma omp distribute simd safelen // expected-error {{expected '(' after 'safelen'}}
26 for (int i
= ST
; i
< N
; i
++)
27 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
31 #pragma omp distribute simd safelen ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
32 for (int i
= ST
; i
< N
; i
++)
33 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
37 #pragma omp distribute simd safelen () // expected-error {{expected expression}}
38 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
42 #pragma omp distribute simd safelen (argc // expected-note {{to match this '('}} expected-error 2 {{integral constant expression}} expected-note 0+{{constant expression}} expected-error {{expected ')'}}
43 for (int i
= ST
; i
< N
; i
++)
44 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
48 #pragma omp distribute simd safelen (ST // expected-error {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error {{expected ')'}} expected-note {{to match this '('}}
49 for (int i
= ST
; i
< N
; i
++)
50 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
54 #pragma omp distribute simd safelen (1)) // expected-warning {{extra tokens at the end of '#pragma omp distribute simd' are ignored}}
55 for (int i
= ST
; i
< N
; i
++)
56 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
60 #pragma omp distribute simd safelen ((ST > 0) ? 1 + ST : 2)
61 for (int i
= ST
; i
< N
; i
++)
62 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
66 // expected-error@+3 2 {{directive '#pragma omp distribute simd' cannot contain more than one 'safelen' clause}}
67 // expected-error@+2 {{argument to 'safelen' clause must be a strictly positive integer value}}
68 // expected-error@+1 2 {{integral constant expression}} expected-note@+1 0+{{constant expression}}
69 #pragma omp distribute simd safelen (foobool(argc)), safelen (true), safelen (-5)
70 for (int i
= ST
; i
< N
; i
++)
71 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
75 #pragma omp distribute simd safelen (S) // expected-error {{'S' does not refer to a value}}
76 for (int i
= ST
; i
< N
; i
++)
77 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
79 #if __cplusplus <= 199711L
80 // expected-error@+6 2 {{integral constant expression}} expected-note@+6 0+{{constant expression}}
82 // expected-error@+4 2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
86 #pragma omp distribute simd safelen (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
87 for (int i
= ST
; i
< N
; i
++)
88 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
92 #pragma omp distribute simd safelen (4)
93 for (int i
= ST
; i
< N
; i
++)
94 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
98 #pragma omp distribute simd safelen (N) // expected-error {{argument to 'safelen' clause must be a strictly positive integer value}}
99 for (T i
= ST
; i
< N
; i
++)
100 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
105 int main(int argc
, char **argv
) {
108 #pragma omp parallel for simd safelen // expected-error {{expected '(' after 'safelen'}}
109 for (int i
= 4; i
< 12; i
++)
110 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
114 #pragma omp parallel for simd safelen ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
115 for (int i
= 4; i
< 12; i
++)
116 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
120 #pragma omp parallel for simd safelen () // expected-error {{expected expression}}
121 for (int i
= 4; i
< 12; i
++)
122 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
126 #pragma omp parallel for simd safelen (4 // expected-error {{expected ')'}} expected-note {{to match this '('}}
127 for (int i
= 4; i
< 12; i
++)
128 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
132 #pragma omp parallel for simd safelen (2+2)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
133 for (int i
= 4; i
< 12; i
++)
134 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
139 #pragma omp parallel for simd safelen (foobool(1) > 0 ? 1 : 2) // expected-error {{integral constant expression}} expected-note 0+{{constant expression}}
140 for (int i
= 4; i
< 12; i
++)
141 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
145 // expected-error@+3 {{argument to 'safelen' clause must be a strictly positive integer value}}
146 // expected-error@+2 2 {{directive '#pragma omp parallel for simd' cannot contain more than one 'safelen' clause}}
147 // expected-error@+1 {{integral constant expression}} expected-note@+1 0+{{constant expression}}
148 #pragma omp parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5)
149 for (int i
= 4; i
< 12; i
++)
150 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
154 #pragma omp parallel for simd safelen (S1) // expected-error {{'S1' does not refer to a value}}
155 for (int i
= 4; i
< 12; i
++)
156 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
158 #if __cplusplus <= 199711L
159 // expected-error@+6 {{integral constant expression}} expected-note@+6 0+{{constant expression}}
161 // expected-error@+4 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
165 #pragma omp distribute simd safelen (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
166 for (int i
= 4; i
< 12; i
++)
167 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
169 // expected-note@+3 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}}
172 #pragma omp distribute simd safelen(safelen(tmain<int, char, -1, -2>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}}
173 foo(); // expected-error {{statement after '#pragma omp distribute 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
);