1 // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
8 bool foobool(int argc
) {
12 struct S1
; // expected-note {{declared here}} expected-note 2 {{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 2 {{candidate constructor not viable: requires 0 arguments, but 1 was provided}}
32 S3(S3
&s3
) : a(s3
.a
) {} // expected-note 2 {{candidate constructor not viable: 1st argument ('const S3') would lose const qualifier}}
47 S5(const S5
&s5
):a(s5
.a
) { }
57 extern int omp_default_mem_alloc
;
60 #pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}}
62 int main(int argc
, char **argv
) {
64 const int da
[5] = { 0 };
70 #pragma omp distribute firstprivate // expected-error {{expected '(' after 'firstprivate'}}
71 for (i
= 0; i
< argc
; ++i
) foo();
72 #pragma omp distribute firstprivate ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
73 for (i
= 0; i
< argc
; ++i
) foo();
74 #pragma omp distribute firstprivate () // expected-error {{expected expression}}
75 for (i
= 0; i
< argc
; ++i
) foo();
78 #pragma omp distribute firstprivate (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
79 for (i
= 0; i
< argc
; ++i
) foo();
82 #pragma omp distribute firstprivate (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
83 for (i
= 0; i
< argc
; ++i
) foo();
86 #pragma omp distribute firstprivate (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
87 for (i
= 0; i
< argc
; ++i
) foo();
90 #pragma omp distribute firstprivate (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
91 for (i
= 0; i
< argc
; ++i
) foo();
94 #pragma omp distribute firstprivate (S1) // expected-error {{'S1' does not refer to a value}}
95 for (i
= 0; i
< argc
; ++i
) foo();
98 #pragma omp distribute firstprivate (a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} expected-warning {{Type 'const S2' is not trivially copyable and not guaranteed to be mapped correctly}} expected-warning {{Type 'const S3' is not trivially copyable and not guaranteed to be mapped correctly}} expected-error {{incomplete type 'S1' where a complete type is required}} expected-error {{no matching constructor for initialization of 'S3'}}
99 for (i
= 0; i
< argc
; ++i
) foo();
102 #pragma omp distribute firstprivate (argv[1]) // expected-error {{expected variable name}}
103 for (i
= 0; i
< argc
; ++i
) foo();
106 #pragma omp distribute firstprivate(ba) // expected-warning {{Type 'const S2[5]' is not trivially copyable and not guaranteed to be mapped correctly}}
107 for (i
= 0; i
< argc
; ++i
) foo();
110 #pragma omp distribute firstprivate(ca) // expected-error {{no matching constructor for initialization of 'S3'}} expected-warning {{Type 'const S3[5]' is not trivially copyable and not guaranteed to be mapped correctly}}
111 for (i
= 0; i
< argc
; ++i
) foo();
114 #pragma omp distribute firstprivate(da, z)
115 for (i
= 0; i
< argc
; ++i
) foo();
118 #pragma omp distribute firstprivate(S2::S2s)
119 for (i
= 0; i
< argc
; ++i
) foo();
122 #pragma omp distribute firstprivate(S2::S2sc)
123 for (i
= 0; i
< argc
; ++i
) foo();
126 #pragma omp distribute firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
127 for (i
= 0; i
< argc
; ++i
) foo();
130 #pragma omp distribute private(i), firstprivate(i) // expected-error {{private variable cannot be firstprivate}} expected-note{{defined as private}}
131 for (i
= 0; i
< argc
; ++i
) foo();
133 #pragma omp teams shared(i)
134 #pragma omp distribute firstprivate(i)
135 for (j
= 0; j
< argc
; ++j
) foo();
137 #pragma omp teams shared(i)
138 #pragma omp distribute firstprivate(i) // expected-note {{defined as firstprivate}}
139 for (i
= 0; i
< argc
; ++i
) foo(); // expected-error {{loop iteration variable in the associated loop of 'omp distribute' directive may not be firstprivate, predetermined as private}}
141 #pragma omp teams private(argc) // expected-note {{defined as private}}
142 #pragma omp distribute firstprivate(argc) // expected-error {{firstprivate variable must be shared}}
143 for (i
= 0; i
< argc
; ++i
) foo();
145 #pragma omp teams reduction(+:argc) // expected-note {{defined as reduction}}
146 #pragma omp distribute firstprivate(argc) // expected-error {{firstprivate variable must be shared}}
147 for (i
= 0; i
< argc
; ++i
) foo();
150 #pragma omp distribute firstprivate(j)
151 for (i
= 0; i
< argc
; ++i
) foo();
154 #pragma omp distribute lastprivate(argc), firstprivate(argc) // expected-error {{lastprivate variable cannot be firstprivate}} expected-note{{defined as lastprivate}}
155 for (i
= 0; i
< argc
; ++i
) foo();
158 #pragma omp distribute firstprivate(argc), lastprivate(argc) // expected-error {{firstprivate variable cannot be lastprivate}} expected-note{{defined as firstprivate}}
159 for (i
= 0; i
< argc
; ++i
) foo();