[OPENMP] Fix for checking of data-sharing attributes for canonical var decls only.

Currently checks for active data-sharing attributes for variables are performed for found var decls. Instead these checks must be performed for canonical decls of these variables to avoid possible troubles with with the differently qualified re-declarations of the same variable, for example:
namespace A { int x; }
namespace B { using A::x; }
Both A::x and B::x actually reference the same object A::x and this fact must be taken into account during data-sharing attributes analysis.

llvm-svn: 235096
This commit is contained in:
Alexey Bataev 2015-04-16 13:49:42 +00:00
parent 2cc44f50a5
commit 6ddfe1a6af
50 changed files with 465 additions and 45 deletions

View File

@ -238,6 +238,7 @@ bool isParallelOrTaskRegion(OpenMPDirectiveKind DKind) {
DSAStackTy::DSAVarData DSAStackTy::getDSA(StackTy::reverse_iterator Iter,
VarDecl *D) {
D = D->getCanonicalDecl();
DSAVarData DVar;
if (Iter == std::prev(Stack.rend())) {
// OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
@ -342,6 +343,7 @@ DSAStackTy::DSAVarData DSAStackTy::getDSA(StackTy::reverse_iterator Iter,
DeclRefExpr *DSAStackTy::addUniqueAligned(VarDecl *D, DeclRefExpr *NewDE) {
assert(Stack.size() > 1 && "Data sharing attributes stack is empty");
D = D->getCanonicalDecl();
auto It = Stack.back().AlignedMap.find(D);
if (It == Stack.back().AlignedMap.end()) {
assert(NewDE && "Unexpected nullptr expr to be added into aligned map");
@ -355,6 +357,7 @@ DeclRefExpr *DSAStackTy::addUniqueAligned(VarDecl *D, DeclRefExpr *NewDE) {
}
void DSAStackTy::addDSA(VarDecl *D, DeclRefExpr *E, OpenMPClauseKind A) {
D = D->getCanonicalDecl();
if (A == OMPC_threadprivate) {
Stack[0].SharingMap[D].Attributes = A;
Stack[0].SharingMap[D].RefExpr = E;
@ -366,6 +369,7 @@ void DSAStackTy::addDSA(VarDecl *D, DeclRefExpr *E, OpenMPClauseKind A) {
}
bool DSAStackTy::isOpenMPLocal(VarDecl *D, StackTy::reverse_iterator Iter) {
D = D->getCanonicalDecl();
if (Stack.size() > 2) {
reverse_iterator I = Iter, E = std::prev(Stack.rend());
Scope *TopScope = nullptr;
@ -385,6 +389,7 @@ bool DSAStackTy::isOpenMPLocal(VarDecl *D, StackTy::reverse_iterator Iter) {
}
DSAStackTy::DSAVarData DSAStackTy::getTopDSA(VarDecl *D, bool FromParent) {
D = D->getCanonicalDecl();
DSAVarData DVar;
// OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
@ -477,6 +482,7 @@ DSAStackTy::DSAVarData DSAStackTy::getTopDSA(VarDecl *D, bool FromParent) {
}
DSAStackTy::DSAVarData DSAStackTy::getImplicitDSA(VarDecl *D, bool FromParent) {
D = D->getCanonicalDecl();
auto StartI = Stack.rbegin();
auto EndI = std::prev(Stack.rend());
if (FromParent && StartI != EndI) {
@ -489,6 +495,7 @@ template <class ClausesPredicate, class DirectivesPredicate>
DSAStackTy::DSAVarData DSAStackTy::hasDSA(VarDecl *D, ClausesPredicate CPred,
DirectivesPredicate DPred,
bool FromParent) {
D = D->getCanonicalDecl();
auto StartI = std::next(Stack.rbegin());
auto EndI = std::prev(Stack.rend());
if (FromParent && StartI != EndI) {
@ -508,6 +515,7 @@ template <class ClausesPredicate, class DirectivesPredicate>
DSAStackTy::DSAVarData
DSAStackTy::hasInnermostDSA(VarDecl *D, ClausesPredicate CPred,
DirectivesPredicate DPred, bool FromParent) {
D = D->getCanonicalDecl();
auto StartI = std::next(Stack.rbegin());
auto EndI = std::prev(Stack.rend());
if (FromParent && StartI != EndI) {
@ -546,6 +554,7 @@ void Sema::InitDataSharingAttributesStack() {
bool Sema::IsOpenMPCapturedVar(VarDecl *VD) {
assert(LangOpts.OpenMP && "OpenMP is not allowed");
VD = VD->getCanonicalDecl();
if (DSAStack->getCurrentDirective() != OMPD_unknown) {
auto DVarPrivate = DSAStack->getTopDSA(VD, /*FromParent=*/false);
if (DVarPrivate.CKind != OMPC_unknown && isOpenMPPrivate(DVarPrivate.CKind))
@ -757,7 +766,7 @@ ExprResult Sema::ActOnOpenMPIdExpression(Scope *CurScope,
// OpenMP [2.9.2, Restrictions, C/C++, p.2-6]
// A threadprivate directive must lexically precede all references to any
// of the variables in its list.
if (VD->isUsed() && !DSAStack->isThreadPrivate(CanonicalVD)) {
if (VD->isUsed() && !DSAStack->isThreadPrivate(VD)) {
Diag(Id.getLoc(), diag::err_omp_var_used)
<< getOpenMPDirectiveName(OMPD_threadprivate) << VD;
return ExprError();

View File

@ -152,6 +152,14 @@ int foomain(int argc, char **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5;
const int da[5] = {0};
@ -288,6 +296,10 @@ int main(int argc, char **argv) {
#pragma omp for firstprivate(i) // expected-error {{firstprivate variable must be shared}}
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel
#pragma omp for firstprivate(B::x) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
for (i = 0; i < argc; ++i)
foo();
return foomain<S4, S5>(argc, argv); // expected-note {{in instantiation of function template specialization 'foomain<S4, S5>' requested here}}
}

View File

@ -142,6 +142,14 @@ int foomain(int argc, char **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5; // expected-note {{constant variable is predetermined as shared}}
const int da[5] = {0}; // expected-note {{constant variable is predetermined as shared}}
@ -237,6 +245,10 @@ int main(int argc, char **argv) {
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel
#pragma omp for lastprivate(B::x) // expected-error {{threadprivate or thread local variable cannot be lastprivate}}
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel
#pragma omp for private(xa), lastprivate(xa) // expected-error {{private variable cannot be lastprivate}} expected-note {{defined as private}}
for (i = 0; i < argc; ++i)
foo();

View File

@ -108,6 +108,14 @@ int foomain(I argc, C **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
S4 e(4);
S5 g(5);
@ -149,6 +157,9 @@ int main(int argc, char **argv) {
#pragma omp for private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp for private(B::x) // expected-error {{threadprivate or thread local variable cannot be private}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp for shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp for'}}
for (int k = 0; k < argc; ++k)
++k;

View File

@ -204,6 +204,14 @@ T tmain(T argc) {
return T();
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5; // expected-note 2 {{'d' defined here}}
const int da[5] = {0}; // expected-note {{'da' defined here}}
@ -313,6 +321,10 @@ int main(int argc, char **argv) {
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel
#pragma omp for reduction(+ : B::x, k) // expected-error {{threadprivate or thread local variable cannot be reduction}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel
#pragma omp for reduction(+ : o) // expected-error {{no viable overloaded '='}}
for (int i = 0; i < 10; ++i)
foo();

View File

@ -152,6 +152,14 @@ int foomain(int argc, char **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5;
const int da[5] = {0};
@ -247,6 +255,10 @@ int main(int argc, char **argv) {
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel
#pragma omp for simd firstprivate(B::x) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel
#pragma omp for simd private(xa), firstprivate(xa) // expected-error {{private variable cannot be firstprivate}} expected-note {{defined as private}}
for (i = 0; i < argc; ++i)
foo();

View File

@ -142,6 +142,14 @@ int foomain(int argc, char **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5; // expected-note {{constant variable is predetermined as shared}}
const int da[5] = {0}; // expected-note {{constant variable is predetermined as shared}}
@ -233,7 +241,7 @@ int main(int argc, char **argv) {
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel
#pragma omp for simd lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}}
#pragma omp for simd lastprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be lastprivate}}
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel

View File

@ -148,6 +148,14 @@ template<class I, class C> int foomain(I argc, C **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace C {
using A::x;
}
int main(int argc, char **argv) {
double darr[100];
// expected-note@+1 {{in instantiation of function template specialization 'test_template<-4, double, int>' requested here}}
@ -185,7 +193,7 @@ int main(int argc, char **argv) {
// expected-error@+1 {{argument of a linear clause should be of integral or pointer type, not 'S5'}}
#pragma omp for simd linear(e, g)
for (int k = 0; k < argc; ++k) ++k;
#pragma omp for simd linear(h) // expected-error {{threadprivate or thread local variable cannot be linear}}
#pragma omp for simd linear(h, C::x) // expected-error 2 {{threadprivate or thread local variable cannot be linear}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp parallel
{

View File

@ -108,6 +108,14 @@ int foomain(I argc, C **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
S4 e(4);
S5 g(5);
@ -146,7 +154,7 @@ int main(int argc, char **argv) {
#pragma omp for simd private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp for simd private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
#pragma omp for simd private(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp for simd shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp for simd'}}

View File

@ -204,6 +204,14 @@ T tmain(T argc) {
return T();
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5; // expected-note 2 {{'d' defined here}}
const int da[5] = {0}; // expected-note {{'da' defined here}}
@ -309,7 +317,7 @@ int main(int argc, char **argv) {
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel
#pragma omp for simd reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}}
#pragma omp for simd reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel

View File

@ -40,6 +40,13 @@ public:
static T s;
};
namespace A {
double x;
#pragma omp threadprivate(x)
}
namespace B {
using A::x;
}
S2 k;
S3 h;
@ -61,6 +68,7 @@ int main(int argc, char **argv) {
#pragma omp parallel copyin(i) // expected-error {{copyin variable must be threadprivate}}
#pragma omp parallel copyin(m) // expected-error {{'operator=' is a private member of 'S5'}}
#pragma omp parallel copyin(ST<int>::s) // expected-error {{copyin variable must be threadprivate}}
#pragma omp parallel copyin(B::x)
foo();
return 0;

View File

@ -47,6 +47,14 @@ public:
S3 h;
#pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5;
const int da[5] = { 0 };
@ -70,7 +78,7 @@ int main(int argc, char **argv) {
#pragma omp parallel firstprivate(S2::S2s)
#pragma omp parallel firstprivate(S2::S2sc)
#pragma omp parallel firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
#pragma omp parallel firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
#pragma omp parallel firstprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be firstprivate}}
#pragma omp parallel private(i), firstprivate(i) // expected-error {{private variable cannot be firstprivate}} expected-note{{defined as private}}
foo();
#pragma omp parallel shared(i)

View File

@ -50,6 +50,14 @@ S4 l(3);
S5 m(4);
#pragma omp threadprivate(h, k, l, m)
namespace A {
double x;
#pragma omp threadprivate(x)
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
int i;
#pragma omp parallel for copyin // expected-error {{expected '(' after 'copyin'}}
@ -85,7 +93,7 @@ int main(int argc, char **argv) {
#pragma omp parallel for copyin(m) // expected-error {{'operator=' is a private member of 'S5'}}
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel for copyin(ST < int > ::s) // expected-error {{copyin variable must be threadprivate}}
#pragma omp parallel for copyin(ST<int>::s, B::x) // expected-error {{copyin variable must be threadprivate}}
for (i = 0; i < argc; ++i)
foo();

View File

@ -137,6 +137,14 @@ int foomain(int argc, char **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5;
const int da[5] = {0};
@ -207,7 +215,7 @@ int main(int argc, char **argv) {
#pragma omp parallel for firstprivate(m) // OK
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel for firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
#pragma omp parallel for firstprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be firstprivate}}
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel for private(xa), firstprivate(xa) // expected-error {{private variable cannot be firstprivate}} expected-note {{defined as private}}

View File

@ -128,6 +128,14 @@ int foomain(int argc, char **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5; // expected-note {{constant variable is predetermined as shared}}
const int da[5] = {0}; // expected-note {{constant variable is predetermined as shared}}
@ -198,7 +206,7 @@ int main(int argc, char **argv) {
#pragma omp parallel for lastprivate(m) // expected-error {{'operator=' is a private member of 'S3'}}
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel for lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}}
#pragma omp parallel for lastprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be lastprivate}}
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel for private(xa), lastprivate(xa) // expected-error {{private variable cannot be lastprivate}} expected-note {{defined as private}}

View File

@ -108,6 +108,14 @@ int foomain(I argc, C **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
S4 e(4);
S5 g(5);
@ -146,7 +154,7 @@ int main(int argc, char **argv) {
#pragma omp parallel for private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel for private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
#pragma omp parallel for private(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel for nowait // expected-error {{unexpected OpenMP clause 'nowait' in directive '#pragma omp parallel for'}}

View File

@ -177,6 +177,14 @@ T tmain(T argc) {
return T();
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5; // expected-note 2 {{'d' defined here}}
const int da[5] = {0}; // expected-note {{'da' defined here}}
@ -258,7 +266,7 @@ int main(int argc, char **argv) {
#pragma omp parallel for reduction(& : e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{invalid operands to binary expression ('S4' and 'S4')}} expected-error {{calling a private constructor of class 'S5'}} expected-error {{invalid operands to binary expression ('S5' and 'S5')}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel for reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}}
#pragma omp parallel for reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel for reduction(+ : o) // expected-error {{no viable overloaded '='}}

View File

@ -50,6 +50,14 @@ S4 l(3);
S5 m(4);
#pragma omp threadprivate(h, k, l, m)
namespace A {
double x;
#pragma omp threadprivate(x)
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
int i;
#pragma omp parallel for simd copyin // expected-error {{expected '(' after 'copyin'}}
@ -85,7 +93,7 @@ int main(int argc, char **argv) {
#pragma omp parallel for simd copyin(m) // expected-error {{'operator=' is a private member of 'S5'}}
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel for simd copyin(ST < int > ::s) // expected-error {{copyin variable must be threadprivate}}
#pragma omp parallel for simd copyin(ST < int > ::s, B::x) // expected-error {{copyin variable must be threadprivate}}
for (i = 0; i < argc; ++i)
foo();

View File

@ -136,6 +136,14 @@ int foomain(int argc, char **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5;
const int da[5] = {0};
@ -206,7 +214,7 @@ int main(int argc, char **argv) {
#pragma omp parallel for simd firstprivate(m) // OK
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel for simd firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
#pragma omp parallel for simd firstprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be firstprivate}}
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel for simd private(xa), firstprivate(xa) // expected-error {{private variable cannot be firstprivate}} expected-note {{defined as private}}

View File

@ -127,6 +127,14 @@ int foomain(int argc, char **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5; // expected-note {{constant variable is predetermined as shared}}
const int da[5] = {0}; // expected-note {{constant variable is predetermined as shared}}
@ -197,7 +205,7 @@ int main(int argc, char **argv) {
#pragma omp parallel for simd lastprivate(m) // expected-error {{'operator=' is a private member of 'S3'}}
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel for simd lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}}
#pragma omp parallel for simd lastprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be lastprivate}}
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel for simd private(xa), lastprivate(xa) // expected-error {{private variable cannot be lastprivate}} expected-note {{defined as private}}

View File

@ -148,6 +148,14 @@ template<class I, class C> int foomain(I argc, C **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace C {
using A::x;
}
int main(int argc, char **argv) {
double darr[100];
// expected-note@+1 {{in instantiation of function template specialization 'test_template<-4, double, int>' requested here}}
@ -185,7 +193,7 @@ int main(int argc, char **argv) {
// expected-error@+1 {{argument of a linear clause should be of integral or pointer type, not 'S5'}}
#pragma omp parallel for simd linear(e, g)
for (int k = 0; k < argc; ++k) ++k;
#pragma omp parallel for simd linear(h) // expected-error {{threadprivate or thread local variable cannot be linear}}
#pragma omp parallel for simd linear(h, C::x) // expected-error 2 {{threadprivate or thread local variable cannot be linear}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp parallel
{

View File

@ -108,6 +108,14 @@ int foomain(I argc, C **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
S4 e(4);
S5 g(5);
@ -146,7 +154,7 @@ int main(int argc, char **argv) {
#pragma omp parallel for simd private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel for simd private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
#pragma omp parallel for simd private(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel for simd nowait // expected-error {{unexpected OpenMP clause 'nowait' in directive '#pragma omp parallel for simd'}}

View File

@ -177,6 +177,14 @@ T tmain(T argc) {
return T();
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5; // expected-note 2 {{'d' defined here}}
const int da[5] = {0}; // expected-note {{'da' defined here}}
@ -258,7 +266,7 @@ int main(int argc, char **argv) {
#pragma omp parallel for simd reduction(& : e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{invalid operands to binary expression ('S4' and 'S4')}} expected-error {{calling a private constructor of class 'S5'}} expected-error {{invalid operands to binary expression ('S5' and 'S5')}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel for simd reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}}
#pragma omp parallel for simd reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel for simd reduction(+ : o) // expected-error {{no viable overloaded '='}}

View File

@ -41,6 +41,14 @@ public:
int threadvar;
#pragma omp threadprivate(threadvar) // expected-note {{defined as threadprivate or thread local}}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5; // expected-note {{constant variable is predetermined as shared}}
const int da[5] = { 0 }; // expected-note {{constant variable is predetermined as shared}}
@ -63,7 +71,7 @@ int main(int argc, char **argv) {
#pragma omp parallel private(da) // expected-error {{shared variable cannot be private}}
#pragma omp parallel private(S2::S2s)
#pragma omp parallel private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
#pragma omp parallel private(threadvar) // expected-error {{threadprivate or thread local variable cannot be private}}
#pragma omp parallel private(threadvar, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}}
#pragma omp parallel shared(i), private(i) // expected-error {{shared variable cannot be private}} expected-note {{defined as shared}}
foo();
#pragma omp parallel firstprivate(i) private(i) // expected-error {{firstprivate variable cannot be private}} expected-note {{defined as firstprivate}}

View File

@ -150,6 +150,14 @@ T tmain(T argc) {
return T();
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5; // expected-note 2 {{'d' defined here}}
const int da[5] = {0}; // expected-note {{'da' defined here}}
@ -208,7 +216,7 @@ int main(int argc, char **argv) {
foo();
#pragma omp parallel reduction(& : e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{nvalid operands to binary expression ('S4' and 'S4')}} expected-error {{calling a private constructor of class 'S5'}} expected-error {{invalid operands to binary expression ('S5' and 'S5')}}
foo();
#pragma omp parallel reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}}
#pragma omp parallel reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}}
foo();
#pragma omp parallel reduction(+ : o) // expected-error {{no viable overloaded '='}}
foo();

View File

@ -50,6 +50,14 @@ S4 l(3);
S5 m(4);
#pragma omp threadprivate(h, k, l, m)
namespace A {
double x;
#pragma omp threadprivate(x)
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
int i;
#pragma omp parallel sections copyin // expected-error {{expected '(' after 'copyin'}}
@ -96,7 +104,7 @@ int main(int argc, char **argv) {
{
foo();
}
#pragma omp parallel sections copyin(ST < int > ::s) // expected-error {{copyin variable must be threadprivate}}
#pragma omp parallel sections copyin(ST < int > ::s, B::x) // expected-error {{copyin variable must be threadprivate}}
{
foo();
}

View File

@ -155,6 +155,14 @@ int foomain(int argc, char **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5;
const int da[5] = {0};
@ -245,7 +253,7 @@ int main(int argc, char **argv) {
{
foo();
}
#pragma omp parallel sections firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
#pragma omp parallel sections firstprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be firstprivate}}
{
foo();
}

View File

@ -142,6 +142,14 @@ int foomain(int argc, char **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5; // expected-note {{constant variable is predetermined as shared}}
const int da[5] = {0}; // expected-note {{constant variable is predetermined as shared}}
@ -232,7 +240,7 @@ int main(int argc, char **argv) {
{
foo();
}
#pragma omp parallel sections lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}}
#pragma omp parallel sections lastprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be lastprivate}}
{
foo();
}

View File

@ -123,6 +123,14 @@ int foomain(I argc, C **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
S4 e(4);
S5 g(5);
@ -172,7 +180,7 @@ int main(int argc, char **argv) {
{
foo();
}
#pragma omp parallel sections private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
#pragma omp parallel sections private(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}}
{
foo();
}

View File

@ -208,6 +208,14 @@ T tmain(T argc) {
return T();
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5; // expected-note 2 {{'d' defined here}}
const int da[5] = {0}; // expected-note {{'da' defined here}}
@ -312,7 +320,7 @@ int main(int argc, char **argv) {
{
foo();
}
#pragma omp parallel sections reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}}
#pragma omp parallel sections reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}}
{
foo();
}

View File

@ -48,6 +48,14 @@ public:
S3 h;
#pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5;
const int da[5] = {0};
@ -83,7 +91,7 @@ int main(int argc, char **argv) {
{ foo(); }
#pragma omp parallel sections shared(e, g)
{ foo(); }
#pragma omp parallel sections shared(h) // expected-error {{threadprivate or thread local variable cannot be shared}}
#pragma omp parallel sections shared(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be shared}}
{ foo(); }
#pragma omp parallel sections private(i), shared(i) // expected-error {{private variable cannot be shared}} expected-note {{defined as private}}
{ foo(); }

View File

@ -44,6 +44,14 @@ public:
S3 h;
#pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5;
const int da[5] = { 0 };
@ -65,7 +73,7 @@ int main(int argc, char **argv) {
#pragma omp parallel shared(ca)
#pragma omp parallel shared(da)
#pragma omp parallel shared(e, g)
#pragma omp parallel shared(h) // expected-error {{threadprivate or thread local variable cannot be shared}}
#pragma omp parallel shared(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be shared}}
#pragma omp parallel private(i), shared(i) // expected-error {{private variable cannot be shared}} expected-note {{defined as private}}
foo();
#pragma omp parallel firstprivate(i), shared(i) // expected-error {{firstprivate variable cannot be shared}} expected-note {{defined as firstprivate}}

View File

@ -170,6 +170,14 @@ int foomain(int argc, char **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5;
const int da[5] = {0};
@ -281,7 +289,7 @@ int main(int argc, char **argv) {
foo();
}
#pragma omp parallel
#pragma omp sections firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
#pragma omp sections firstprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be firstprivate}}
{
foo();
}

View File

@ -156,6 +156,14 @@ int foomain(int argc, char **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5; // expected-note {{constant variable is predetermined as shared}}
const int da[5] = {0}; // expected-note {{constant variable is predetermined as shared}}
@ -267,7 +275,7 @@ int main(int argc, char **argv) {
foo();
}
#pragma omp parallel
#pragma omp sections lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}}
#pragma omp sections lastprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be lastprivate}}
{
foo();
}

View File

@ -123,6 +123,14 @@ int foomain(I argc, C **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
S4 e(4);
S5 g(5);
@ -172,7 +180,7 @@ int main(int argc, char **argv) {
{
foo();
}
#pragma omp sections private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
#pragma omp sections private(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}}
{
foo();
}

View File

@ -235,6 +235,14 @@ T tmain(T argc) {
return T();
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5; // expected-note 2 {{'d' defined here}}
const int da[5] = {0}; // expected-note {{'da' defined here}}
@ -363,7 +371,7 @@ int main(int argc, char **argv) {
foo();
}
#pragma omp parallel
#pragma omp sections reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}}
#pragma omp sections reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}}
{
foo();
}

View File

@ -53,6 +53,14 @@ public:
S3 h;
#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
template <class I, class C>
int foomain(I argc, C **argv) {
I e(4);
@ -92,7 +100,7 @@ int foomain(I argc, C **argv) {
#pragma omp simd lastprivate(e, g)
for (int k = 0; k < argc; ++k)
++k;
#pragma omp simd lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}}
#pragma omp simd lastprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be lastprivate}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp simd firstprivate(i) // expected-error {{unexpected OpenMP clause 'firstprivate' in directive '#pragma omp simd'}}

View File

@ -148,6 +148,14 @@ template<class I, class C> int foomain(I argc, C **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace C {
using A::x;
}
int main(int argc, char **argv) {
double darr[100];
// expected-note@+1 {{in instantiation of function template specialization 'test_template<-4, double, int>' requested here}}
@ -177,7 +185,7 @@ int main(int argc, char **argv) {
for (int k = 0; k < argc; ++k) ++k;
// expected-error@+2 {{linear variable with incomplete type 'S1'}}
// expected-error@+1 {{const-qualified variable cannot be linear}}
#pragma omp simd linear (a, b)
#pragma omp simd linear(a, b)
for (int k = 0; k < argc; ++k) ++k;
#pragma omp simd linear (argv[1]) // expected-error {{expected variable name}}
for (int k = 0; k < argc; ++k) ++k;
@ -185,7 +193,7 @@ int main(int argc, char **argv) {
// expected-error@+1 {{argument of a linear clause should be of integral or pointer type, not 'S5'}}
#pragma omp simd linear(e, g)
for (int k = 0; k < argc; ++k) ++k;
#pragma omp simd linear(h) // expected-error {{threadprivate or thread local variable cannot be linear}}
#pragma omp simd linear(h, C::x) // expected-error 2 {{threadprivate or thread local variable cannot be linear}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp parallel
{

View File

@ -85,6 +85,14 @@ template<class I, class C> int foomain(I argc, C **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
S4 e(4);
S5 g(5);
@ -112,7 +120,7 @@ int main(int argc, char **argv) {
for (int k = 0; k < argc; ++k) ++k;
#pragma omp simd private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp simd private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
#pragma omp simd private(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp simd shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp simd'}}
for (int k = 0; k < argc; ++k) ++k;

View File

@ -180,6 +180,14 @@ T tmain(T argc) {
return T();
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5; // expected-note 2 {{'d' defined here}}
const int da[5] = {0}; // expected-note {{'da' defined here}}
@ -261,7 +269,7 @@ int main(int argc, char **argv) {
#pragma omp simd reduction(& : e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{invalid operands to binary expression ('S4' and 'S4')}} expected-error {{calling a private constructor of class 'S5'}} expected-error {{invalid operands to binary expression ('S5' and 'S5')}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp simd reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}}
#pragma omp simd reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp simd reduction(+ : o) // expected-error {{no viable overloaded '='}}

View File

@ -105,6 +105,14 @@ T tmain(T argc, C **argv) {
return T();
}
namespace A {
double x;
#pragma omp threadprivate(x)
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
int i;
static int intA;
@ -121,7 +129,7 @@ int main(int argc, char **argv) {
#pragma omp parallel
#pragma omp single copyprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
#pragma omp parallel
#pragma omp single copyprivate(l) // expected-error {{'operator=' is a private member of 'S4'}}
#pragma omp single copyprivate(l, B::x) // expected-error {{'operator=' is a private member of 'S4'}}
#pragma omp parallel
#pragma omp single copyprivate(S1) // expected-error {{'S1' does not refer to a value}}
#pragma omp parallel

View File

@ -132,6 +132,14 @@ int foomain(int argc, char **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5;
const int da[5] = {0};
@ -203,7 +211,7 @@ int main(int argc, char **argv) {
#pragma omp single firstprivate(m) // OK
foo();
#pragma omp parallel
#pragma omp single firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
#pragma omp single firstprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be firstprivate}}
foo();
#pragma omp parallel
#pragma omp single private(xa), firstprivate(xa) // expected-error {{private variable cannot be firstprivate}} expected-note {{defined as private}}

View File

@ -91,6 +91,14 @@ int foomain(I argc, C **argv) {
return 0;
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
S4 e(4);
S5 g(5);
@ -118,7 +126,7 @@ int main(int argc, char **argv) {
foo();
#pragma omp single private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
foo();
#pragma omp single private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
#pragma omp single private(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}}
foo();
#pragma omp single shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp single'}}
foo();

View File

@ -51,6 +51,14 @@ public:
S3 h;
#pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5;
const int da[5] = {0};
@ -74,7 +82,7 @@ int main(int argc, char **argv) {
#pragma omp task firstprivate(S2::S2s)
#pragma omp task firstprivate(S2::S2sc)
#pragma omp task firstprivate(e, g) // expected-error 2 {{calling a private constructor of class 'S4'}} expected-error 2 {{calling a private constructor of class 'S5'}}
#pragma omp task firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
#pragma omp task firstprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be firstprivate}}
#pragma omp task private(i), firstprivate(i) // expected-error {{private variable cannot be firstprivate}} expected-note{{defined as private}}
foo();
#pragma omp task shared(i)

View File

@ -45,6 +45,14 @@ public:
int threadvar;
#pragma omp threadprivate(threadvar) // expected-note {{defined as threadprivate or thread local}}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5; // expected-note {{constant variable is predetermined as shared}}
const int da[5] = {0}; // expected-note {{constant variable is predetermined as shared}}
@ -67,7 +75,7 @@ int main(int argc, char **argv) {
#pragma omp task private(da) // expected-error {{shared variable cannot be private}}
#pragma omp task private(S2::S2s)
#pragma omp task private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
#pragma omp task private(threadvar) // expected-error {{threadprivate or thread local variable cannot be private}}
#pragma omp task private(threadvar, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}}
#pragma omp task shared(i), private(i) // expected-error {{shared variable cannot be private}} expected-note {{defined as shared}}
foo();
#pragma omp task firstprivate(i) private(i) // expected-error {{firstprivate variable cannot be private}} expected-note {{defined as firstprivate}}

View File

@ -48,6 +48,14 @@ public:
S3 h;
#pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5;
const int da[5] = {0};
@ -83,7 +91,7 @@ int main(int argc, char **argv) {
foo();
#pragma omp task shared(e, g)
foo();
#pragma omp task shared(h) // expected-error {{threadprivate or thread local variable cannot be shared}}
#pragma omp task shared(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be shared}}
foo();
#pragma omp task private(i), shared(i) // expected-error {{private variable cannot be shared}} expected-note {{defined as private}}
foo();

View File

@ -49,6 +49,14 @@ public:
S3 h;
#pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5;
const int da[5] = {0};
@ -105,7 +113,7 @@ int main(int argc, char **argv) {
#pragma omp teams firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
foo();
#pragma omp target
#pragma omp teams firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
#pragma omp teams firstprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be firstprivate}}
foo();
#pragma omp target
#pragma omp teams private(i), firstprivate(i) // expected-error {{private variable cannot be firstprivate}} expected-note{{defined as private}}

View File

@ -41,6 +41,14 @@ public:
int threadvar;
#pragma omp threadprivate(threadvar) // expected-note {{defined as threadprivate or thread local}}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5; // expected-note {{constant variable is predetermined as shared}}
const int da[5] = { 0 }; // expected-note {{constant variable is predetermined as shared}}
@ -94,7 +102,7 @@ int main(int argc, char **argv) {
#pragma omp teams private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
foo();
#pragma omp target
#pragma omp teams private(threadvar) // expected-error {{threadprivate or thread local variable cannot be private}}
#pragma omp teams private(threadvar, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}}
foo();
#pragma omp target
#pragma omp teams shared(i), private(i) // expected-error {{shared variable cannot be private}} expected-note {{defined as shared}}

View File

@ -183,6 +183,14 @@ T tmain(T argc) {
return T();
}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5; // expected-note 2 {{'d' defined here}}
const int da[5] = {0}; // expected-note {{'da' defined here}}
@ -265,7 +273,7 @@ int main(int argc, char **argv) {
#pragma omp teams reduction(& : e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{invalid operands to binary expression ('S4' and 'S4')}} expected-error {{calling a private constructor of class 'S5'}} expected-error {{invalid operands to binary expression ('S5' and 'S5')}}
foo();
#pragma omp target
#pragma omp teams reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}}
#pragma omp teams reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}}
foo();
#pragma omp target
#pragma omp teams reduction(+ : o) // expected-error {{no viable overloaded '='}}

View File

@ -44,6 +44,14 @@ public:
S3 h;
#pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}}
namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}
int main(int argc, char **argv) {
const int d = 5;
const int da[5] = { 0 };
@ -94,7 +102,7 @@ int main(int argc, char **argv) {
#pragma omp teams shared(e, g)
foo();
#pragma omp target
#pragma omp teams shared(h) // expected-error {{threadprivate or thread local variable cannot be shared}}
#pragma omp teams shared(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be shared}}
foo();
#pragma omp target
#pragma omp teams private(i), shared(i) // expected-error {{private variable cannot be shared}} expected-note {{defined as private}}