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;
26 S3 &operator=(const S3 &s3);
29 S3() : a(0) {} // expected-note 2 {{candidate constructor not viable: requires 0 arguments, but 1 was provided}}
30 S3(S3 &s3) : a(s3.a) {} // expected-note 2 {{candidate constructor not viable: 1st argument ('const S3') would lose const qualifier}}
45 S5(const S5 &s5):a(s5.a) { }
56 #pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}}
58 int main(int argc, char **argv) {
60 const int da[5] = { 0 };
67 #pragma omp target teams distribute firstprivate // expected-error {{expected '(' after 'firstprivate'}}
68 for (i = 0; i < argc; ++i) foo();
70 #pragma omp target teams distribute firstprivate ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
71 for (i = 0; i < argc; ++i) foo();
73 #pragma omp target teams distribute firstprivate () // expected-error {{expected expression}}
74 for (i = 0; i < argc; ++i) foo();
76 #pragma omp target teams distribute firstprivate (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
77 for (i = 0; i < argc; ++i) foo();
79 #pragma omp target teams distribute firstprivate (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
80 for (i = 0; i < argc; ++i) foo();
82 #pragma omp target teams distribute firstprivate (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
83 for (i = 0; i < argc; ++i) foo();
85 #pragma omp target teams distribute firstprivate (argc)
86 for (i = 0; i < argc; ++i) foo();
88 #pragma omp target teams distribute firstprivate (S1) // expected-error {{'S1' does not refer to a value}}
89 for (i = 0; i < argc; ++i) foo();
91 #pragma omp target teams distribute firstprivate (a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} expected-error {{no matching constructor for initialization of 'S3'}}
92 for (i = 0; i < argc; ++i) foo();
94 #pragma omp target teams distribute firstprivate (argv[1]) // expected-error {{expected variable name}}
95 for (i = 0; i < argc; ++i) foo();
97 #pragma omp target teams distribute firstprivate(ba)
98 for (i = 0; i < argc; ++i) foo();
101 #pragma omp teams distribute firstprivate(ca) // expected-error {{no matching constructor for initialization of 'S3'}}
102 for (i = 0; i < argc; ++i) foo();
104 #pragma omp target teams distribute firstprivate(da)
105 for (i = 0; i < argc; ++i) foo();
107 #pragma omp target teams distribute firstprivate(S2::S2s)
108 for (i = 0; i < argc; ++i) foo();
110 #pragma omp target teams distribute firstprivate(S2::S2sc)
111 for (i = 0; i < argc; ++i) foo();
113 #pragma omp target teams distribute firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
114 for (i = 0; i < argc; ++i) foo();
116 #pragma omp target teams distribute private(i), firstprivate(i) // expected-error {{private variable cannot be firstprivate}} expected-note{{defined as private}}
117 for (i = 0; i < argc; ++i) foo();
119 #pragma omp target teams distribute firstprivate(i)
120 for (j = 0; j < argc; ++j) foo();
122 #pragma omp target teams distribute firstprivate(i) // expected-note {{defined as firstprivate}}
123 for (i = 0; i < argc; ++i) foo(); // expected-error {{loop iteration variable in the associated loop of 'omp target teams distribute' directive may not be firstprivate, predetermined as private}}
125 #pragma omp target teams distribute firstprivate(j)
126 for (i = 0; i < argc; ++i) foo();
128 #pragma omp target teams distribute lastprivate(argc), firstprivate(argc) // OK
129 for (i = 0; i < argc; ++i) foo();