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
) {
24 #pragma omp teams distribute simd safelen // expected-error {{expected '(' after 'safelen'}}
25 for (int i
= ST
; i
< N
; i
++)
26 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
29 #pragma omp teams distribute simd safelen ( // 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
];
34 #pragma omp teams distribute simd safelen () // expected-error {{expected expression}}
35 for (int i
= ST
; i
< N
; i
++) argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
38 #pragma omp teams distribute simd safelen (argc // expected-note {{to match this '('}} expected-error 2 {{integral constant expression}} expected-note 0+{{constant expression}} expected-error {{expected ')'}}
39 for (int i
= ST
; i
< N
; i
++)
40 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
43 #pragma omp teams 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 '('}}
44 for (int i
= ST
; i
< N
; i
++)
45 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
48 #pragma omp teams distribute simd safelen (1)) // expected-warning {{extra tokens at the end of '#pragma omp teams distribute simd' are ignored}}
49 for (int i
= ST
; i
< N
; i
++)
50 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
53 #pragma omp teams distribute simd safelen ((ST > 0) ? 1 + ST : 2)
54 for (int i
= ST
; i
< N
; i
++)
55 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
58 // expected-error@+3 2 {{directive '#pragma omp teams distribute simd' cannot contain more than one 'safelen' clause}}
59 // expected-error@+2 {{argument to 'safelen' clause must be a strictly positive integer value}}
60 // expected-error@+1 2 {{integral constant expression}} expected-note@+1 0+{{constant expression}}
61 #pragma omp teams distribute simd safelen (foobool(argc)), safelen (true), safelen (-5)
62 for (int i
= ST
; i
< N
; i
++)
63 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
66 #pragma omp teams distribute simd safelen (S) // expected-error {{'S' does not refer to a value}}
67 for (int i
= ST
; i
< N
; i
++)
68 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
70 #if __cplusplus <= 199711L
71 // expected-error@+5 2 {{integral constant expression}} expected-note@+5 0+{{constant expression}}
73 // expected-error@+3 2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
76 #pragma omp teams distribute simd safelen (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
77 for (int i
= ST
; i
< N
; i
++)
78 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
81 #pragma omp teams distribute simd safelen (4)
82 for (int i
= ST
; i
< N
; i
++)
83 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
86 #pragma omp teams distribute simd safelen (N) // expected-error {{argument to 'safelen' clause must be a strictly positive integer value}}
87 for (T i
= ST
; i
< N
; i
++)
88 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-ST
];
93 int main(int argc
, char **argv
) {
95 #pragma omp teams distribute simd safelen // expected-error {{expected '(' after 'safelen'}}
96 for (int i
= 4; i
< 12; i
++)
97 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
100 #pragma omp teams distribute simd safelen ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
101 for (int i
= 4; i
< 12; i
++)
102 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
105 #pragma omp teams distribute simd safelen () // expected-error {{expected expression}}
106 for (int i
= 4; i
< 12; i
++)
107 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
110 #pragma omp teams distribute simd safelen (4 // expected-error {{expected ')'}} expected-note {{to match this '('}}
111 for (int i
= 4; i
< 12; i
++)
112 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
115 #pragma omp teams distribute simd safelen (2+2)) // expected-warning {{extra tokens at the end of '#pragma omp teams distribute simd' are ignored}}
116 for (int i
= 4; i
< 12; i
++)
117 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
121 #pragma omp teams distribute simd safelen (foobool(1) > 0 ? 1 : 2) // expected-error {{integral constant expression}} expected-note 0+{{constant expression}}
122 for (int i
= 4; i
< 12; i
++)
123 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
126 // expected-error@+3 {{argument to 'safelen' clause must be a strictly positive integer value}}
127 // expected-error@+2 2 {{directive '#pragma omp teams distribute simd' cannot contain more than one 'safelen' clause}}
128 // expected-error@+1 {{integral constant expression}} expected-note@+1 0+{{constant expression}}
129 #pragma omp teams distribute simd safelen (foobool(argc)), safelen (true), safelen (-5)
130 for (int i
= 4; i
< 12; i
++)
131 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
134 #pragma omp teams distribute simd safelen (S1) // expected-error {{'S1' does not refer to a value}}
135 for (int i
= 4; i
< 12; i
++)
136 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
138 #if __cplusplus <= 199711L
139 // expected-error@+5 {{integral constant expression}} expected-note@+5 0+{{constant expression}}
141 // expected-error@+3 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
144 #pragma omp teams distribute simd safelen (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
145 for (int i
= 4; i
< 12; i
++)
146 argv
[0][i
] = argv
[0][i
] - argv
[0][i
-4];
148 // expected-note@+2 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}}
150 #pragma omp teams distribute simd safelen(safelen(tmain<int, char, -1, -2>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}}
151 foo(); // expected-error {{statement after '#pragma omp teams distribute simd' must be a for loop}}
153 // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 12, 4>' requested here}}
154 return tmain
<int, char, 12, 4>(argc
, argv
);