1 // RUN: %clang_cc1 -verify -fopenmp %s
6 bool foobool(int argc) {
10 struct S1; // expected-note {{declared here}} expected-note{{forward declaration of 'S1'}}
17 S2(const S2 &s2) : a(s2.a) {}
19 static const float S2sc;
21 const float S2::S2sc = 0;
29 S3(const S3 &s3) : a(s3.a) {}
37 S4(const S4 &s4); // expected-note {{implicitly declared private here}}
44 S5(const S5 &s5) : a(s5.a) {} // expected-note {{implicitly declared private here}}
50 #pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}}
54 #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
60 int main(int argc, char **argv) {
62 const int da[5] = {0};
67 #pragma omp target teams firstprivate // expected-error {{expected '(' after 'firstprivate'}}
69 #pragma omp target teams firstprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
71 #pragma omp target teams firstprivate() // expected-error {{expected expression}}
73 #pragma omp target teams firstprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
75 #pragma omp target teams firstprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
77 #pragma omp target teams firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
79 #pragma omp target teams firstprivate(argc)
81 #pragma omp target teams firstprivate(S1) // expected-error {{'S1' does not refer to a value}}
83 #pragma omp target teams firstprivate(a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}}
85 #pragma omp target teams firstprivate(argv[1]) // expected-error {{expected variable name}}
87 #pragma omp target teams firstprivate(ba)
89 #pragma omp target teams firstprivate(ca)
91 #pragma omp target teams firstprivate(da)
93 #pragma omp target teams firstprivate(S2::S2s)
95 #pragma omp target teams firstprivate(S2::S2sc)
97 #pragma omp target teams firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
99 #pragma omp target teams firstprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be firstprivate}}
101 #pragma omp target teams private(i), firstprivate(i) // expected-error {{private variable cannot be firstprivate}} expected-note{{defined as private}}
103 #pragma omp target teams shared(i)
105 #pragma omp target teams firstprivate(i)
107 #pragma omp target teams firstprivate(j)
110 #pragma omp target teams firstprivate(m) // OK