1*73e5d7bdSFazlay Rabbi // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
2*73e5d7bdSFazlay Rabbi // RUN: %clang_cc1 -verify -fopenmp -std=c++98 %s -Wuninitialized
3*73e5d7bdSFazlay Rabbi // RUN: %clang_cc1 -verify -fopenmp -std=c++11 %s -Wuninitialized
4*73e5d7bdSFazlay Rabbi
5*73e5d7bdSFazlay Rabbi // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
6*73e5d7bdSFazlay Rabbi // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s -Wuninitialized
7*73e5d7bdSFazlay Rabbi // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s -Wuninitialized
8*73e5d7bdSFazlay Rabbi
9*73e5d7bdSFazlay Rabbi // expected-note@* 0+{{declared here}}
10*73e5d7bdSFazlay Rabbi
foo()11*73e5d7bdSFazlay Rabbi void foo() {
12*73e5d7bdSFazlay Rabbi }
13*73e5d7bdSFazlay Rabbi
foobool(int argc)14*73e5d7bdSFazlay Rabbi bool foobool(int argc) {
15*73e5d7bdSFazlay Rabbi return argc;
16*73e5d7bdSFazlay Rabbi }
17*73e5d7bdSFazlay Rabbi
18*73e5d7bdSFazlay Rabbi struct S1;
19*73e5d7bdSFazlay Rabbi
20*73e5d7bdSFazlay Rabbi template <class T, typename S, int N, int ST>
tmain(T argc,S ** argv)21*73e5d7bdSFazlay Rabbi T tmain(T argc, S **argv) {
22*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd simdlen // expected-error {{expected '(' after 'simdlen'}}
23*73e5d7bdSFazlay Rabbi for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
24*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd simdlen ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
25*73e5d7bdSFazlay Rabbi for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
26*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd simdlen () // expected-error {{expected expression}}
27*73e5d7bdSFazlay Rabbi for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
28*73e5d7bdSFazlay Rabbi // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
29*73e5d7bdSFazlay Rabbi // expected-error@+1 2 {{integral constant expression}} expected-note@+1 0+{{constant expression}}
30*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd simdlen (argc
31*73e5d7bdSFazlay Rabbi for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
32*73e5d7bdSFazlay Rabbi // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
33*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd simdlen (ST // expected-error {{expected ')'}} expected-note {{to match this '('}}
34*73e5d7bdSFazlay Rabbi for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
35*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd simdlen (1)) // expected-warning {{extra tokens at the end of '#pragma omp masked taskloop simd' are ignored}}
36*73e5d7bdSFazlay Rabbi for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
37*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd simdlen ((ST > 0) ? 1 + ST : 2)
38*73e5d7bdSFazlay Rabbi for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
39*73e5d7bdSFazlay Rabbi // expected-error@+3 2 {{directive '#pragma omp masked taskloop simd' cannot contain more than one 'simdlen' clause}}
40*73e5d7bdSFazlay Rabbi // expected-error@+2 {{argument to 'simdlen' clause must be a strictly positive integer value}}
41*73e5d7bdSFazlay Rabbi // expected-error@+1 2 {{integral constant expression}} expected-note@+1 0+{{constant expression}}
42*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd simdlen (foobool(argc)), simdlen (true), simdlen (-5)
43*73e5d7bdSFazlay Rabbi for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
44*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd simdlen (S) // expected-error {{'S' does not refer to a value}}
45*73e5d7bdSFazlay Rabbi for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
46*73e5d7bdSFazlay Rabbi #if __cplusplus <= 199711L
47*73e5d7bdSFazlay Rabbi // expected-error@+4 2 {{integral constant expression}} expected-note@+4 0+{{constant expression}}
48*73e5d7bdSFazlay Rabbi #else
49*73e5d7bdSFazlay Rabbi // expected-error@+2 2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
50*73e5d7bdSFazlay Rabbi #endif
51*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd simdlen (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
52*73e5d7bdSFazlay Rabbi for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
53*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd simdlen (4)
54*73e5d7bdSFazlay Rabbi for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
55*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd simdlen (N) // expected-error {{argument to 'simdlen' clause must be a strictly positive integer value}}
56*73e5d7bdSFazlay Rabbi for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
57*73e5d7bdSFazlay Rabbi return argc;
58*73e5d7bdSFazlay Rabbi }
59*73e5d7bdSFazlay Rabbi
main(int argc,char ** argv)60*73e5d7bdSFazlay Rabbi int main(int argc, char **argv) {
61*73e5d7bdSFazlay Rabbi int tid = 0;
62*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd simdlen filter(tid) // expected-error {{expected '(' after 'simdlen'}}
63*73e5d7bdSFazlay Rabbi for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
64*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd simdlen ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
65*73e5d7bdSFazlay Rabbi for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
66*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd simdlen () // expected-error {{expected expression}}
67*73e5d7bdSFazlay Rabbi for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
68*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd simdlen (4 // expected-error {{expected ')'}} expected-note {{to match this '('}}
69*73e5d7bdSFazlay Rabbi for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
70*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd simdlen (2+2)) // expected-warning {{extra tokens at the end of '#pragma omp masked taskloop simd' are ignored}}
71*73e5d7bdSFazlay Rabbi for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
72*73e5d7bdSFazlay Rabbi // expected-error@+1 {{integral constant expression}} expected-note@+1 0+{{constant expression}}
73*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd simdlen (foobool(1) > 0 ? 1 : 2)
74*73e5d7bdSFazlay Rabbi for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
75*73e5d7bdSFazlay Rabbi // expected-error@+3 {{integral constant expression}} expected-note@+3 0+{{constant expression}}
76*73e5d7bdSFazlay Rabbi // expected-error@+2 2 {{directive '#pragma omp masked taskloop simd' cannot contain more than one 'simdlen' clause}}
77*73e5d7bdSFazlay Rabbi // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
78*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd simdlen (foobool(argc)), simdlen (true), simdlen (-5)
79*73e5d7bdSFazlay Rabbi for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
80*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd simdlen (S1) // expected-error {{'S1' does not refer to a value}}
81*73e5d7bdSFazlay Rabbi for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
82*73e5d7bdSFazlay Rabbi #if __cplusplus <= 199711L
83*73e5d7bdSFazlay Rabbi // expected-error@+4 {{integral constant expression}} expected-note@+4 0+{{constant expression}}
84*73e5d7bdSFazlay Rabbi #else
85*73e5d7bdSFazlay Rabbi // expected-error@+2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
86*73e5d7bdSFazlay Rabbi #endif
87*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd simdlen (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
88*73e5d7bdSFazlay Rabbi for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
89*73e5d7bdSFazlay Rabbi // expected-error@+3 {{statement after '#pragma omp masked taskloop simd' must be a for loop}}
90*73e5d7bdSFazlay Rabbi // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}}
91*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd simdlen(simdlen(tmain<int, char, -1, -2>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}}
92*73e5d7bdSFazlay Rabbi foo();
93*73e5d7bdSFazlay Rabbi // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 12, 4>' requested here}}
94*73e5d7bdSFazlay Rabbi return tmain<int, char, 12, 4>(argc, argv);
95*73e5d7bdSFazlay Rabbi }
96*73e5d7bdSFazlay Rabbi
97