1 // RUN: %clang_cc1 -verify -fopenmp %s -Wno-openmp-target
3 // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-target
8 bool foobool(int argc) {
12 struct S1; // expected-note {{declared here}} expected-note{{forward declaration of 'S1'}}
19 S2(const S2 &s2) : a(s2.a) {}
21 static const float S2sc;
23 const float S2::S2sc = 0;
28 S3 &operator=(const S3 &s3);
31 S3() : a(0) {} // expected-note {{candidate constructor not viable: requires 0 arguments, but 1 was provided}}
32 S3(S3 &s3) : a(s3.a) {} // expected-note {{candidate constructor not viable: 1st argument ('const S3') would lose const qualifier}}
47 S5(const S5 &s5):a(s5.a) { }
58 #pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}}
60 int main(int argc, char **argv) {
62 const int da[5] = { 0 };
70 #pragma omp teams distribute simd firstprivate // expected-error {{expected '(' after 'firstprivate'}}
71 for (i = 0; i < argc; ++i) foo();
74 #pragma omp teams distribute simd firstprivate ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
75 for (i = 0; i < argc; ++i) foo();
78 #pragma omp teams distribute simd firstprivate () // expected-error {{expected expression}}
79 for (i = 0; i < argc; ++i) foo();
82 #pragma omp teams distribute simd firstprivate (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
83 for (i = 0; i < argc; ++i) foo();
86 #pragma omp teams distribute simd firstprivate (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
87 for (i = 0; i < argc; ++i) foo();
90 #pragma omp teams distribute simd firstprivate (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
91 for (i = 0; i < argc; ++i) foo();
94 #pragma omp teams distribute simd firstprivate (argc)
95 for (i = 0; i < argc; ++i) foo();
98 #pragma omp teams distribute simd firstprivate (S1) // expected-error {{'S1' does not refer to a value}}
99 for (i = 0; i < argc; ++i) foo();
102 #pragma omp teams distribute simd firstprivate (a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}}
103 for (i = 0; i < argc; ++i) foo();
106 #pragma omp teams distribute simd firstprivate (argv[1]) // expected-error {{expected variable name}}
107 for (i = 0; i < argc; ++i) foo();
110 #pragma omp teams distribute simd firstprivate(ba)
111 for (i = 0; i < argc; ++i) foo();
114 #pragma omp teams distribute simd firstprivate(ca) // expected-error {{no matching constructor for initialization of 'S3'}}
115 for (i = 0; i < argc; ++i) foo();
118 #pragma omp teams distribute simd firstprivate(da)
119 for (i = 0; i < argc; ++i) foo();
122 #pragma omp teams distribute simd firstprivate(S2::S2s)
123 for (i = 0; i < argc; ++i) foo();
126 #pragma omp teams distribute simd firstprivate(S2::S2sc)
127 for (i = 0; i < argc; ++i) foo();
130 #pragma omp teams distribute simd firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
131 for (i = 0; i < argc; ++i) foo();
134 #pragma omp teams distribute simd private(i), firstprivate(i) // expected-error {{private variable cannot be firstprivate}} expected-note 2 {{defined as private}}
135 for (i = 0; i < argc; ++i) foo(); // expected-error {{loop iteration variable in the associated loop of 'omp teams distribute simd' directive may not be private, predetermined as linear}}
138 #pragma omp teams distribute simd firstprivate(i)
139 for (j = 0; j < argc; ++j) foo();
142 #pragma omp teams distribute simd firstprivate(i) // expected-note {{defined as firstprivate}}
143 for (i = 0; i < argc; ++i) foo(); // expected-error {{loop iteration variable in the associated loop of 'omp teams distribute simd' directive may not be firstprivate, predetermined as linear}}
146 #pragma omp teams distribute simd firstprivate(j)
147 for (i = 0; i < argc; ++i) foo();
149 // expected-error@+2 {{lastprivate variable cannot be firstprivate}} expected-note@+2 {{defined as lastprivate}}
151 #pragma omp teams distribute simd lastprivate(argc), firstprivate(argc) // OK
152 for (i = 0; i < argc; ++i) foo();