// OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
// in a Construct, C/C++, predetermined, p.4]
// Static data members are shared.
- if (D->isStaticDataMember()) {
- DVar.CKind = OMPC_shared;
- return DVar;
- }
-
// OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
// in a Construct, C/C++, predetermined, p.7]
// Variables with static storage duration that are declared in a scope
// inside the construct are shared.
- if (D->isStaticLocal()) {
+ if (D->isStaticDataMember() || D->isStaticLocal()) {
+ DSAVarData DVarTemp =
+ hasDSA(D, isOpenMPPrivate, MatchesAlways(), FromParent);
+ if (DVarTemp.CKind != OMPC_unknown && DVarTemp.RefExpr)
+ return DVar;
+
DVar.CKind = OMPC_shared;
return DVar;
}
template <class T, class C>
T tmain(T argc, C **argv) {
T i;
+ static T TA;
#pragma omp parallel
#pragma omp single copyprivate // expected-error {{expected '(' after 'copyprivate'}}
#pragma omp parallel
#pragma omp parallel
#pragma omp single firstprivate(i) copyprivate(i) // expected-error {{firstprivate variable cannot be copyprivate}} expected-note {{defined as firstprivate}}
foo();
+#pragma omp parallel private(TA)
+ {
+#pragma omp single copyprivate(TA)
+ TA = 99;
+ }
return T();
}
int main(int argc, char **argv) {
int i;
+ static int intA;
#pragma omp parallel
#pragma omp single copyprivate // expected-error {{expected '(' after 'copyprivate'}}
#pragma omp parallel
foo();
#pragma omp single copyprivate(i) nowait // expected-error {{the 'copyprivate' clause must not be used with the 'nowait' clause}} expected-note {{'nowait' clause is here}}
foo();
+#pragma omp parallel private(intA)
+ {
+#pragma omp single copyprivate(intA)
+ intA = 99;
+ }
return tmain(argc, argv); // expected-note {{in instantiation of function template specialization 'tmain<int, char>' requested here}}
}