1 // RUN: %clang_cc1 -verify -fopenmp %s
3 // RUN: %clang_cc1 -verify -fopenmp-simd %s
8 bool foobool(int argc) {
12 struct S1; // expected-note {{declared here}} expected-note {{forward declaration of 'S1'}}
18 static float S2s; // expected-note {{predetermined as shared}}
27 const S3 c; // expected-note {{predetermined as shared}}
28 const S3 ca[5]; // expected-note {{predetermined as shared}}
29 extern const int f; // expected-note {{predetermined as shared}}
32 S4(); // expected-note {{implicitly declared private here}}
38 S5():a(0) {} // expected-note {{implicitly declared private here}}
44 #pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}}
47 int main(int argc, char **argv) {
48 const int d = 5; // expected-note {{predetermined as shared}}
49 const int da[5] = { 0 }; // expected-note {{predetermined as shared}}
56 #pragma omp teams distribute simd private // expected-error {{expected '(' after 'private'}}
57 for (int k = 0; k < argc; ++k) ++k;
60 #pragma omp teams distribute simd private ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
61 for (int k = 0; k < argc; ++k) ++k;
64 #pragma omp teams distribute simd private () // expected-error {{expected expression}}
65 for (int k = 0; k < argc; ++k) ++k;
68 #pragma omp teams distribute simd private (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
69 for (int k = 0; k < argc; ++k) ++k;
72 #pragma omp teams distribute simd private (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
73 for (int k = 0; k < argc; ++k) ++k;
76 #pragma omp teams distribute simd private (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
77 for (int k = 0; k < argc; ++k) ++k;
80 #pragma omp teams distribute simd private (argc)
81 for (int k = 0; k < argc; ++k) ++k;
84 #pragma omp teams distribute simd private (S1) // expected-error {{'S1' does not refer to a value}}
85 for (int k = 0; k < argc; ++k) ++k;
88 #pragma omp teams distribute simd private (a, b, c, d, f) // expected-error {{private variable with incomplete type 'S1'}} expected-error 3 {{shared variable cannot be private}}
89 for (int k = 0; k < argc; ++k) ++k;
92 #pragma omp teams distribute simd private (argv[1]) // expected-error {{expected variable name}}
93 for (int k = 0; k < argc; ++k) ++k;
96 #pragma omp teams distribute simd private(ba)
97 for (int k = 0; k < argc; ++k) ++k;
100 #pragma omp teams distribute simd private(ca) // expected-error {{shared variable cannot be private}}
101 for (int k = 0; k < argc; ++k) ++k;
104 #pragma omp teams distribute simd private(da) // expected-error {{shared variable cannot be private}}
105 for (int k = 0; k < argc; ++k) ++k;
108 #pragma omp teams distribute simd private(S2::S2s) // expected-error {{shared variable cannot be private}}
109 for (int k = 0; k < argc; ++k) ++k;
112 #pragma omp teams distribute simd private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
113 for (int k = 0; k < argc; ++k) ++k;
116 #pragma omp teams distribute simd private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
117 for (int k = 0; k < argc; ++k) ++k;
120 #pragma omp teams distribute simd shared(i)
121 for (int k = 0; k < argc; ++k) ++k;
124 #pragma omp teams distribute simd firstprivate(i), private(i) // expected-error {{firstprivate variable cannot be private}} expected-note {{defined as firstprivate}}
125 for (int k = 0; k < argc; ++k) ++k;
128 #pragma omp teams distribute simd private(j)
129 for (int k = 0; k < argc; ++k) ++k;
132 #pragma omp teams distribute simd reduction(+:i)
133 for (int k = 0; k < argc; ++k) ++k;
135 #pragma omp distribute private(i)
136 for (int k = 0; k < 10; ++k) {
138 #pragma omp teams distribute simd private(i)
139 for (int x = 0; x < 10; ++x) foo();
143 #pragma omp teams distribute simd firstprivate(i)
144 for (int k = 0; k < 10; ++k) {