1 // RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp -ferror-limit 100 -o - %s -Wuninitialized
2 
3 // RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized
4 
foo()5 void foo() {
6 }
7 
foobool(int argc)8 bool foobool(int argc) {
9   return argc;
10 }
11 
12 struct S1; // expected-note {{declared here}} expected-note {{declared here}}
13 
14 template <class T, int N>
15 T tmain(T argc) {
16   T b = argc, c, d, e, f, g;
17   char ** argv;
18   static T a;
19   T k;
20 #pragma omp target
21 #pragma omp teams
22 #pragma omp distribute parallel for simd dist_schedule // expected-error {{expected '(' after 'dist_schedule'}}
23   for (int i = 0; i < 10; ++i) foo();
24 #pragma omp target
25 #pragma omp teams
26 #pragma omp distribute parallel for simd dist_schedule ( // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
27   for (int i = 0; i < 10; ++i) foo();
28 #pragma omp target
29 #pragma omp teams
30 #pragma omp distribute parallel for simd dist_schedule () // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}}
31   for (int i = 0; i < 10; ++i) foo();
32 #pragma omp target
33 #pragma omp teams
34 #pragma omp distribute parallel for simd dist_schedule (static // expected-error {{expected ')'}} expected-note {{to match this '('}}
35   for (int i = 0; i < 10; ++i) foo();
36 #pragma omp target
37 #pragma omp teams
38 #pragma omp distribute parallel for simd dist_schedule (static, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
39   for (int i = 0; i < 10; ++i) foo();
40 #pragma omp target
41 #pragma omp teams
42 #pragma omp distribute parallel for simd dist_schedule (argc)) // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}}
43   for (int i = 0; i < 10; ++i) foo();
44 #pragma omp target
45 #pragma omp teams
46 #pragma omp distribute parallel for simd dist_schedule (static, argc > 0 ? argv[1] : argv[2]) // expected-error2 {{expression must have integral or unscoped enumeration type, not 'char *'}}
47   for (int i = 0; i < 10; ++i) foo();
48 #pragma omp target
49 #pragma omp teams
50 #pragma omp distribute parallel for simd dist_schedule (static), dist_schedule (static, k) // expected-error {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'dist_schedule' clause}}
51   for (int i = 0; i < 10; ++i) foo();
52 #pragma omp target
53 #pragma omp teams
54 #pragma omp distribute parallel for simd dist_schedule (static, S1) // expected-error {{'S1' does not refer to a value}}
55   for (int i = 0; i < 10; ++i) foo();
56 #pragma omp target
57 #pragma omp teams
58 #pragma omp distribute parallel for simd dist_schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error3 {{expression must have integral or unscoped enumeration type, not 'char *'}}
59   for (int i = 0; i < 10; ++i) foo();
60   return T();
61 }
62 
main(int argc,char ** argv)63 int main(int argc, char **argv) {
64   int k;
65 #pragma omp target
66 #pragma omp teams
67 #pragma omp distribute parallel for simd dist_schedule // expected-error {{expected '(' after 'dist_schedule'}}
68   for (int i = 0; i < 10; ++i) foo();
69 #pragma omp target
70 #pragma omp teams
71 #pragma omp distribute parallel for simd dist_schedule ( // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
72   for (int i = 0; i < 10; ++i) foo();
73 #pragma omp target
74 #pragma omp teams
75 #pragma omp distribute parallel for simd dist_schedule () // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}}
76   for (int i = 0; i < 10; ++i) foo();
77 #pragma omp target
78 #pragma omp teams
79 #pragma omp distribute parallel for simd dist_schedule (static // expected-error {{expected ')'}} expected-note {{to match this '('}}
80   for (int i = 0; i < 10; ++i) foo();
81 #pragma omp target
82 #pragma omp teams
83 #pragma omp distribute parallel for simd dist_schedule (static, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
84   for (int i = 0; i < 10; ++i) foo();
85 #pragma omp target
86 #pragma omp teams
87 #pragma omp distribute parallel for simd dist_schedule (argc)) // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}}
88   for (int i = 0; i < 10; ++i) foo();
89 #pragma omp target
90 #pragma omp teams
91 #pragma omp distribute parallel for simd dist_schedule (static, argc > 0 ? argv[1] : argv[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
92   for (int i = 0; i < 10; ++i) foo();
93 #pragma omp target
94 #pragma omp teams
95 #pragma omp distribute parallel for simd dist_schedule (static), dist_schedule (static, k) // expected-error {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'dist_schedule' clause}}
96   for (int i = 0; i < 10; ++i) foo();
97 #pragma omp target
98 #pragma omp teams
99 #pragma omp distribute parallel for simd dist_schedule (static, S1) // expected-error {{'S1' does not refer to a value}}
100   for (int i = 0; i < 10; ++i) foo();
101 #pragma omp target
102 #pragma omp teams
103 #pragma omp distribute parallel for simd dist_schedule (static, argv[1]=2) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
104   for (int i = 0; i < 10; ++i) foo();
105   return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0])); // expected-note {{in instantiation of function template specialization 'tmain<int, 5>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<char, 1>' requested here}}
106 }
107