def note_omp_explicit_dsa : Note<
"defined as %0">;
def note_omp_predetermined_dsa : Note<
- "predetermined as %0">;
+ "%select{static data member is predetermined as shared|"
+ "variable with static storage duration is predetermined as shared|"
+ "loop iteration variable is predetermined as private|"
+ "loop iteration variable is predetermined as linear|"
+ "loop iteration variable is predetermined as lastprivate|"
+ "constant variable is predetermined as shared|"
+ "global variable is predetermined as shared|"
+ "variable with automatic storage duration is predetermined as private}0"
+ "%select{|; perhaps you forget to enclose 'omp %2' directive into a parallel or another task region?}1">;
def err_omp_loop_var_dsa : Error<
"loop iteration variable may not be %0">;
def err_omp_not_for : Error<
DSA_none = 1 << 0, /// \brief Default data sharing attribute 'none'.
DSA_shared = 1 << 1 /// \brief Default data sharing attribute 'shared'.
};
+
template <class T> struct MatchesAny {
explicit MatchesAny(ArrayRef<T> Arr) : Arr(std::move(Arr)) {}
bool operator()(T Kind) {
};
struct MatchesAlways {
MatchesAlways() {}
- template <class T>
- bool operator()(T) { return true; }
+ template <class T> bool operator()(T) { return true; }
};
typedef MatchesAny<OpenMPClauseKind> MatchesAnyClause;
/// \brief Stack of used declaration and their data-sharing attributes.
StackTy Stack;
- Sema &Actions;
+ Sema &SemaRef;
typedef SmallVector<SharingMapTy, 8>::reverse_iterator reverse_iterator;
bool isOpenMPLocal(VarDecl *D, StackTy::reverse_iterator Iter);
public:
- explicit DSAStackTy(Sema &S) : Stack(1), Actions(S) {}
+ explicit DSAStackTy(Sema &S) : Stack(1), SemaRef(S) {}
void push(OpenMPDirectiveKind DKind, const DeclarationNameInfo &DirName,
Scope *CurScope) {
if (D->isStaticDataMember()) {
// Variables with const-qualified type having no mutable member may be
// listed in a firstprivate clause, even if they are static data members.
- DSAVarData DVarTemp = hasDSA(D, MatchesAnyClause(OMPC_firstprivate),
- MatchesAlways());
+ DSAVarData DVarTemp =
+ hasDSA(D, MatchesAnyClause(OMPC_firstprivate), MatchesAlways());
if (DVarTemp.CKind == OMPC_firstprivate && DVarTemp.RefExpr)
return DVar;
}
QualType Type = D->getType().getNonReferenceType().getCanonicalType();
- bool IsConstant = Type.isConstant(Actions.getASTContext());
+ bool IsConstant = Type.isConstant(SemaRef.getASTContext());
while (Type->isArrayType()) {
QualType ElemType = cast<ArrayType>(Type.getTypePtr())->getElementType();
Type = ElemType.getNonReferenceType().getCanonicalType();
// Variables with const qualified type having no mutable member are
// shared.
CXXRecordDecl *RD =
- Actions.getLangOpts().CPlusPlus ? Type->getAsCXXRecordDecl() : nullptr;
+ SemaRef.getLangOpts().CPlusPlus ? Type->getAsCXXRecordDecl() : nullptr;
if (IsConstant &&
- !(Actions.getLangOpts().CPlusPlus && RD && RD->hasMutableFields())) {
+ !(SemaRef.getLangOpts().CPlusPlus && RD && RD->hasMutableFields())) {
// Variables with const-qualified type having no mutable member may be
// listed in a firstprivate clause, even if they are static data members.
- DSAVarData DVarTemp = hasDSA(D, MatchesAnyClause(OMPC_firstprivate),
- MatchesAlways());
+ DSAVarData DVarTemp =
+ hasDSA(D, MatchesAnyClause(OMPC_firstprivate), MatchesAlways());
if (DVarTemp.CKind == OMPC_firstprivate && DVarTemp.RefExpr)
return DVar;
class VarDeclFilterCCC : public CorrectionCandidateCallback {
private:
- Sema &Actions;
+ Sema &SemaRef;
public:
- explicit VarDeclFilterCCC(Sema &S) : Actions(S) {}
+ explicit VarDeclFilterCCC(Sema &S) : SemaRef(S) {}
bool ValidateCandidate(const TypoCorrection &Candidate) override {
NamedDecl *ND = Candidate.getCorrectionDecl();
if (VarDecl *VD = dyn_cast_or_null<VarDecl>(ND)) {
return VD->hasGlobalStorage() &&
- Actions.isDeclInScope(ND, Actions.getCurLexicalContext(),
- Actions.getCurScope());
+ SemaRef.isDeclInScope(ND, SemaRef.getCurLexicalContext(),
+ SemaRef.getCurScope());
}
return false;
}
return D;
}
+static void ReportOriginalDSA(Sema &SemaRef, DSAStackTy *Stack,
+ const VarDecl *VD, DSAStackTy::DSAVarData DVar,
+ bool IsLoopIterVar = false) {
+ if (DVar.RefExpr) {
+ SemaRef.Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
+ << getOpenMPClauseName(DVar.CKind);
+ return;
+ }
+ enum {
+ PDSA_StaticMemberShared,
+ PDSA_StaticLocalVarShared,
+ PDSA_LoopIterVarPrivate,
+ PDSA_LoopIterVarLinear,
+ PDSA_LoopIterVarLastprivate,
+ PDSA_ConstVarShared,
+ PDSA_GlobalVarShared,
+ PDSA_LocalVarPrivate
+ } Reason;
+ bool ReportHint = false;
+ if (IsLoopIterVar) {
+ if (DVar.CKind == OMPC_private)
+ Reason = PDSA_LoopIterVarPrivate;
+ else if (DVar.CKind == OMPC_lastprivate)
+ Reason = PDSA_LoopIterVarLastprivate;
+ else
+ Reason = PDSA_LoopIterVarLinear;
+ } else if (VD->isStaticLocal())
+ Reason = PDSA_StaticLocalVarShared;
+ else if (VD->isStaticDataMember())
+ Reason = PDSA_StaticMemberShared;
+ else if (VD->isFileVarDecl())
+ Reason = PDSA_GlobalVarShared;
+ else if (VD->getType().isConstant(SemaRef.getASTContext()))
+ Reason = PDSA_ConstVarShared;
+ else {
+ ReportHint = true;
+ Reason = PDSA_LocalVarPrivate;
+ }
+
+ SemaRef.Diag(VD->getLocation(), diag::note_omp_predetermined_dsa)
+ << Reason << ReportHint
+ << getOpenMPDirectiveName(Stack->getCurrentDirective());
+}
+
namespace {
class DSAAttrChecker : public StmtVisitor<DSAAttrChecker, void> {
DSAStackTy *Stack;
- Sema &Actions;
+ Sema &SemaRef;
bool ErrorFound;
CapturedStmt *CS;
llvm::SmallVector<Expr *, 8> ImplicitFirstprivate;
if (DVar.CKind == OMPC_unknown && Stack->getDefaultDSA() == DSA_none &&
(isOpenMPParallelDirective(DKind) || DKind == OMPD_task)) {
ErrorFound = true;
- Actions.Diag(ELoc, diag::err_omp_no_dsa_for_variable) << VD;
+ SemaRef.Diag(ELoc, diag::err_omp_no_dsa_for_variable) << VD;
return;
}
MatchesAlways());
if (DKind == OMPD_task && DVar.CKind == OMPC_reduction) {
ErrorFound = true;
- Actions.Diag(ELoc, diag::err_omp_reduction_in_task);
- if (DVar.RefExpr) {
- Actions.Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(OMPC_reduction);
- }
+ SemaRef.Diag(ELoc, diag::err_omp_reduction_in_task);
+ ReportOriginalDSA(SemaRef, Stack, VD, DVar);
return;
}
bool isErrorFound() { return ErrorFound; }
ArrayRef<Expr *> getImplicitFirstprivate() { return ImplicitFirstprivate; }
- DSAAttrChecker(DSAStackTy *S, Sema &Actions, CapturedStmt *CS)
- : Stack(S), Actions(Actions), ErrorFound(false), CS(CS) {}
+ DSAAttrChecker(DSAStackTy *S, Sema &SemaRef, CapturedStmt *CS)
+ : Stack(S), SemaRef(SemaRef), ErrorFound(false), CS(CS) {}
};
} // namespace
// associated for-loop.
SemaRef.Diag(Init->getLocStart(), diag::err_omp_loop_var_dsa)
<< getOpenMPClauseName(DVar.CKind);
- if (DVar.RefExpr)
- SemaRef.Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(DVar.CKind);
- else
- SemaRef.Diag(Var->getLocation(), diag::note_omp_predetermined_dsa)
- << getOpenMPClauseName(DVar.CKind);
+ ReportOriginalDSA(SemaRef, &DSA, Var, DVar, true);
HasErrors = true;
} else {
// Make the loop iteration variable private by default.
DSA.addDSA(Var, nullptr, OMPC_private);
}
- assert(isOpenMPLoopDirective(DKind) && "DSA for non-simd loop vars");
+ assert(isOpenMPLoopDirective(DKind) && "DSA for non-loop vars");
// Check test-expr.
HasErrors |= ISC.CheckCond(For->getCond());
if (DVar.CKind != OMPC_unknown && DVar.CKind != OMPC_private) {
Diag(ELoc, diag::err_omp_wrong_dsa) << getOpenMPClauseName(DVar.CKind)
<< getOpenMPClauseName(OMPC_private);
- if (DVar.RefExpr) {
- Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(DVar.CKind);
- } else {
- Diag(VD->getLocation(), diag::note_omp_predetermined_dsa)
- << getOpenMPClauseName(DVar.CKind);
- }
+ ReportOriginalDSA(*this, DSAStack, VD, DVar);
continue;
}
Diag(ELoc, diag::err_omp_wrong_dsa)
<< getOpenMPClauseName(DVar.CKind)
<< getOpenMPClauseName(OMPC_firstprivate);
- Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(DVar.CKind);
+ ReportOriginalDSA(*this, DSAStack, VD, DVar);
continue;
}
Diag(ELoc, diag::err_omp_wrong_dsa)
<< getOpenMPClauseName(DVar.CKind)
<< getOpenMPClauseName(OMPC_firstprivate);
- Diag(VD->getLocation(), diag::note_omp_predetermined_dsa)
- << getOpenMPClauseName(DVar.CKind);
+ ReportOriginalDSA(*this, DSAStack, VD, DVar);
continue;
}
Diag(ELoc, diag::err_omp_required_access)
<< getOpenMPClauseName(OMPC_firstprivate)
<< getOpenMPClauseName(OMPC_shared);
- if (DVar.RefExpr) {
- Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(DVar.CKind);
- }
+ ReportOriginalDSA(*this, DSAStack, VD, DVar);
continue;
}
}
Diag(ELoc, diag::err_omp_wrong_dsa)
<< getOpenMPClauseName(DVar.CKind)
<< getOpenMPClauseName(OMPC_lastprivate);
- if (DVar.RefExpr)
- Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(DVar.CKind);
- else
- Diag(VD->getLocation(), diag::note_omp_predetermined_dsa)
- << getOpenMPClauseName(DVar.CKind);
+ ReportOriginalDSA(*this, DSAStack, VD, DVar);
continue;
}
Diag(ELoc, diag::err_omp_required_access)
<< getOpenMPClauseName(OMPC_lastprivate)
<< getOpenMPClauseName(OMPC_shared);
- if (DVar.RefExpr)
- Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(DVar.CKind);
- else
- Diag(VD->getLocation(), diag::note_omp_predetermined_dsa)
- << getOpenMPClauseName(DVar.CKind);
+ ReportOriginalDSA(*this, DSAStack, VD, DVar);
continue;
}
}
DVar.RefExpr) {
Diag(ELoc, diag::err_omp_wrong_dsa) << getOpenMPClauseName(DVar.CKind)
<< getOpenMPClauseName(OMPC_shared);
- Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(DVar.CKind);
+ ReportOriginalDSA(*this, DSAStack, VD, DVar);
continue;
}
Diag(ELoc, diag::err_omp_wrong_dsa)
<< getOpenMPClauseName(DVar.CKind)
<< getOpenMPClauseName(OMPC_reduction);
- if (DVar.RefExpr) {
- Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(DVar.CKind);
- } else {
- Diag(VD->getLocation(), diag::note_omp_predetermined_dsa)
- << getOpenMPClauseName(DVar.CKind);
- }
+ ReportOriginalDSA(*this, DSAStack, VD, DVar);
continue;
}
Diag(ELoc, diag::err_omp_required_access)
<< getOpenMPClauseName(OMPC_reduction)
<< getOpenMPClauseName(OMPC_shared);
- if (DVar.RefExpr) {
- Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(DVar.CKind);
- }
+ ReportOriginalDSA(*this, DSAStack, VD, DVar);
continue;
}
}
if (DVar.RefExpr) {
Diag(ELoc, diag::err_omp_wrong_dsa) << getOpenMPClauseName(DVar.CKind)
<< getOpenMPClauseName(OMPC_linear);
- Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(DVar.CKind);
+ ReportOriginalDSA(*this, DSAStack, VD, DVar);
continue;
}
static T a;
// CHECK: static T a;
#pragma omp for
-// CHECK-NEXT: #pragma omp for
- for (int i=0; i < 2; ++i) a=2;
+ // CHECK-NEXT: #pragma omp for
+ for (int i = 0; i < 2; ++i)
+ a = 2;
// CHECK-NEXT: for (int i = 0; i < 2; ++i)
// CHECK-NEXT: a = 2;
#pragma omp parallel
-#pragma omp for private(argc,b),firstprivate(c, d),lastprivate(d,f) collapse(N)
+#pragma omp for private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N)
for (int i = 0; i < 10; ++i)
- for (int j = 0; j < 10; ++j)foo();
-// CHECK-NEXT: #pragma omp parallel
-// CHECK-NEXT: #pragma omp for private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N)
-// CHECK-NEXT: for (int i = 0; i < 10; ++i)
-// CHECK-NEXT: for (int j = 0; j < 10; ++j)
-// CHECK-NEXT: foo();
+ for (int j = 0; j < 10; ++j)
+ foo();
+ // CHECK-NEXT: #pragma omp parallel
+ // CHECK-NEXT: #pragma omp for private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N)
+ // CHECK-NEXT: for (int i = 0; i < 10; ++i)
+ // CHECK-NEXT: for (int j = 0; j < 10; ++j)
+ // CHECK-NEXT: foo();
return T();
}
static int a;
// CHECK: static int a;
#pragma omp for
-// CHECK-NEXT: #pragma omp for
- for (int i=0; i < 2; ++i)a=2;
+ // CHECK-NEXT: #pragma omp for
+ for (int i = 0; i < 2; ++i)
+ a = 2;
// CHECK-NEXT: for (int i = 0; i < 2; ++i)
// CHECK-NEXT: a = 2;
#pragma omp parallel
-#pragma omp for private(argc,b),firstprivate(argv, c),lastprivate(d,f) collapse(2)
+#pragma omp for private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2)
for (int i = 0; i < 10; ++i)
- for (int j = 0; j < 10; ++j)foo();
-// CHECK-NEXT: #pragma omp parallel
-// CHECK-NEXT: #pragma omp for private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2)
-// CHECK-NEXT: for (int i = 0; i < 10; ++i)
-// CHECK-NEXT: for (int j = 0; j < 10; ++j)
-// CHECK-NEXT: foo();
+ for (int j = 0; j < 10; ++j)
+ foo();
+ // CHECK-NEXT: #pragma omp parallel
+ // CHECK-NEXT: #pragma omp for private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2)
+ // CHECK-NEXT: for (int i = 0; i < 10; ++i)
+ // CHECK-NEXT: for (int j = 0; j < 10; ++j)
+ // CHECK-NEXT: foo();
return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0]));
}
I e(4); // expected-note {{'e' defined here}}
C g(5); // expected-note 2 {{'g' defined here}}
int i;
- int &j = i; // expected-note {{'j' defined here}}
+ int &j = i; // expected-note {{'j' defined here}}
#pragma omp parallel
#pragma omp for firstprivate // expected-error {{expected '(' after 'firstprivate'}}
for (int k = 0; k < argc; ++k)
#pragma omp parallel
{
int v = 0;
- int i; // expected-note {{predetermined as private}}
+ int i; // expected-note {{variable with automatic storage duration is predetermined as private; perhaps you forget to enclose 'omp for' directive into a parallel or another task region?}}
#pragma omp for firstprivate(i) // expected-error {{private variable cannot be firstprivate}}
for (int k = 0; k < argc; ++k) {
i = k;
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel reduction(+ : i) // expected-note {{defined as reduction}}
-#pragma omp for firstprivate(i) // expected-error {{firstprivate variable must be shared}}
+#pragma omp for firstprivate(i) // expected-error {{firstprivate variable must be shared}}
for (i = 0; i < argc; ++i)
foo();
return 0;
S3 m;
S6 n(2);
int i;
- int &j = i; // expected-note {{'j' defined here}}
+ int &j = i; // expected-note {{'j' defined here}}
#pragma omp parallel
#pragma omp for firstprivate // expected-error {{expected '(' after 'firstprivate'}}
for (i = 0; i < argc; ++i)
#pragma omp parallel
{
int v = 0;
- int i; // expected-note {{predetermined as private}}
+ int i; // expected-note {{variable with automatic storage duration is predetermined as private; perhaps you forget to enclose 'omp for' directive into a parallel or another task region?}}
#pragma omp for firstprivate(i) // expected-error {{private variable cannot be firstprivate}}
for (int k = 0; k < argc; ++k) {
i = k;
for (i = 0; i < argc; ++i)
foo();
#pragma omp parallel reduction(+ : i) // expected-note {{defined as reduction}}
-#pragma omp for firstprivate(i) // expected-error {{firstprivate variable must be shared}}
+#pragma omp for firstprivate(i) // expected-error {{firstprivate variable must be shared}}
for (i = 0; i < argc; ++i)
foo();
public:
S2() : a(0) {}
S2(S2 &s2) : a(s2.a) {}
- static float S2s; // expected-note {{predetermined as shared}}
+ static float S2s; // expected-note {{static data member is predetermined as shared}}
static const float S2sc;
};
-const float S2::S2sc = 0; // expected-note {{predetermined as shared}}
+const float S2::S2sc = 0; // expected-note {{static data member is predetermined as shared}}
const S2 b;
const S2 ba[5];
class S3 { // expected-note 2 {{'S3' declared here}}
S3() : a(0) {}
S3(S3 &s3) : a(s3.a) {}
};
-const S3 c; // expected-note {{predetermined as shared}}
-const S3 ca[5]; // expected-note {{predetermined as shared}}
-extern const int f; // expected-note {{predetermined as shared}}
+const S3 c; // expected-note {{global variable is predetermined as shared}}
+const S3 ca[5]; // expected-note {{global variable is predetermined as shared}}
+extern const int f; // expected-note {{global variable is predetermined as shared}}
class S4 { // expected-note 3 {{'S4' declared here}}
int a;
S4();
#pragma omp parallel
{
int v = 0;
- int i; // expected-note {{predetermined as private}}
+ int i; // expected-note {{variable with automatic storage duration is predetermined as private; perhaps you forget to enclose 'omp for' directive into a parallel or another task region?}}
#pragma omp for lastprivate(i) // expected-error {{lastprivate variable must be shared}}
for (int k = 0; k < argc; ++k) {
i = k;
}
int main(int argc, char **argv) {
- const int d = 5; // expected-note {{predetermined as shared}}
- const int da[5] = {0}; // expected-note {{predetermined as shared}}
+ 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}}
S4 e(4); // expected-note {{'e' defined here}}
S5 g(5); // expected-note {{'g' defined here}}
S3 m; // expected-note 2 {{'m' defined here}}
extern S1 a;
class S2 {
mutable int a;
+
public:
- S2():a(0) { }
+ S2() : a(0) {}
};
const S2 b;
const S2 ba[5];
class S3 {
int a;
+
public:
- S3():a(0) { }
+ S3() : a(0) {}
};
const S3 ca[5];
class S4 { // expected-note {{'S4' declared here}}
int a;
S4();
+
public:
- S4(int v):a(v) { }
+ S4(int v) : a(v) {}
};
class S5 { // expected-note {{'S5' declared here}}
int a;
- S5():a(0) {}
+ S5() : a(0) {}
+
public:
- S5(int v):a(v) { }
+ S5(int v) : a(v) {}
};
S3 h;
#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
-template<class I, class C> int foomain(I argc, C **argv) {
+template <class I, class C>
+int foomain(I argc, C **argv) {
I e(4);
I g(5);
int i;
- int &j = i; // expected-note {{'j' defined here}}
- #pragma omp for private // expected-error {{expected '(' after 'private'}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private () // expected-error {{expected expression}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (argc)
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (S1) // expected-error {{'S1' does not refer to a value}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (a, b) // expected-error {{private variable with incomplete type 'S1'}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (argv[1]) // expected-error {{expected variable name}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private(e, g)
- for (int k = 0; k < argc; ++k) ++k;
- #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 shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp for'}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp parallel
+ int &j = i; // expected-note {{'j' defined here}}
+#pragma omp for private // expected-error {{expected '(' after 'private'}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private() // expected-error {{expected expression}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(argc)
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(S1) // expected-error {{'S1' does not refer to a value}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(a, b) // expected-error {{private variable with incomplete type 'S1'}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(argv[1]) // expected-error {{expected variable name}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(e, g)
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#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 shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp for'}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp parallel
{
int v = 0;
int i;
- #pragma omp for private(i)
- for (int k = 0; k < argc; ++k) { i = k; v += i; }
+#pragma omp for private(i)
+ for (int k = 0; k < argc; ++k) {
+ i = k;
+ v += i;
+ }
}
- #pragma omp parallel shared(i)
- #pragma omp parallel private(i)
- #pragma omp for private(j) // expected-error {{arguments of OpenMP clause 'private' cannot be of reference type}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private(i)
- for (int k = 0; k < argc; ++k) ++k;
+#pragma omp parallel shared(i)
+#pragma omp parallel private(i)
+#pragma omp for private(j) // expected-error {{arguments of OpenMP clause 'private' cannot be of reference type}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(i)
+ for (int k = 0; k < argc; ++k)
+ ++k;
return 0;
}
S4 e(4); // expected-note {{'e' defined here}}
S5 g(5); // expected-note {{'g' defined here}}
int i;
- int &j = i; // expected-note {{'j' defined here}}
- #pragma omp for private // expected-error {{expected '(' after 'private'}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private () // expected-error {{expected expression}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (argc)
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (S1) // expected-error {{'S1' does not refer to a value}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (a, b) // expected-error {{private variable with incomplete type 'S1'}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private (argv[1]) // expected-error {{expected variable name}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private(e, g) // expected-error 2 {{private variable must have an accessible, unambiguous default constructor}}
- for (int k = 0; k < argc; ++k) ++k;
- #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 shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp for'}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp parallel
+ int &j = i; // expected-note {{'j' defined here}}
+#pragma omp for private // expected-error {{expected '(' after 'private'}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private() // expected-error {{expected expression}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(argc)
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(S1) // expected-error {{'S1' does not refer to a value}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(a, b) // expected-error {{private variable with incomplete type 'S1'}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(argv[1]) // expected-error {{expected variable name}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(e, g) // expected-error 2 {{private variable must have an accessible, unambiguous default constructor}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#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 shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp for'}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp parallel
{
int i;
- #pragma omp for private(i)
- for (int k = 0; k < argc; ++k) ++k;
+#pragma omp for private(i)
+ for (int k = 0; k < argc; ++k)
+ ++k;
}
- #pragma omp parallel shared(i)
- #pragma omp parallel private(i)
- #pragma omp for private(j) // expected-error {{arguments of OpenMP clause 'private' cannot be of reference type}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp for private(i)
- for (int k = 0; k < argc; ++k) ++k;
+#pragma omp parallel shared(i)
+#pragma omp parallel private(i)
+#pragma omp for private(j) // expected-error {{arguments of OpenMP clause 'private' cannot be of reference type}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp for private(i)
+ for (int k = 0; k < argc; ++k)
+ ++k;
return 0;
}
public:
S2() : a(0) {}
S2(S2 &s2) : a(s2.a) {}
- static float S2s; // expected-note 2 {{predetermined as shared}}
+ static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
static const float S2sc;
};
const float S2::S2sc = 0; // expected-note 2 {{'S2sc' defined here}}
// expected-no-diagnostics
int a;
-#pragma omp threadprivate(a,b)
+#pragma omp threadprivate(a, b)
#pragma omp parallel
// expected-no-diagnostics
int a;
-#pragma omp threadprivate(a,b)
+#pragma omp threadprivate(a, b)
#pragma omp parallel
mutable int a;
public:
S2():a(0) { }
- static float S2s; // expected-note {{predetermined as shared}}
+ static float S2s; // expected-note {{static data member is predetermined as shared}}
};
const S2 b;
const S2 ba[5];
public:
S3():a(0) { }
};
-const S3 c; // expected-note {{predetermined as shared}}
-const S3 ca[5]; // expected-note {{predetermined as shared}}
-extern const int f; // expected-note {{predetermined as shared}}
+const S3 c; // expected-note {{global variable is predetermined as shared}}
+const S3 ca[5]; // expected-note {{global variable is predetermined as shared}}
+extern const int f; // expected-note {{global variable is predetermined as shared}}
class S4 { // expected-note {{'S4' declared here}}
int a;
S4();
#pragma omp threadprivate(threadvar) // expected-note {{defined as threadprivate or thread local}}
int main(int argc, char **argv) {
- const int d = 5; // expected-note {{predetermined as shared}}
- const int da[5] = { 0 }; // expected-note {{predetermined as shared}}
+ 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}}
S4 e(4); // expected-note {{'e' defined here}}
S5 g(5); // expected-note {{'g' defined here}}
int i;
public:
S2() : a(0) {}
S2(S2 &s2) : a(s2.a) {}
- static float S2s; // expected-note 2 {{predetermined as shared}}
+ static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
static const float S2sc;
};
const float S2::S2sc = 0; // expected-note 2 {{'S2sc' defined here}}
extern S1 a;
class S2 {
mutable int a;
+
public:
- S2():a(0) { }
- S2(S2 &s2):a(s2.a) { }
- static float S2s; // expected-note {{predetermined as shared}}
+ S2() : a(0) {}
+ S2(S2 &s2) : a(s2.a) {}
+ static float S2s; // expected-note {{static data member is predetermined as shared}}
static const float S2sc;
};
-const float S2::S2sc = 0; // expected-note {{predetermined as shared}}
+const float S2::S2sc = 0; // expected-note {{static data member is predetermined as shared}}
const S2 b;
const S2 ba[5];
class S3 { // expected-note {{'S3' declared here}}
int a;
- S3& operator =(const S3& s3);
+ S3 &operator=(const S3 &s3);
+
public:
- S3():a(0) { }
- S3(S3 &s3):a(s3.a) { }
+ S3() : a(0) {}
+ S3(S3 &s3) : a(s3.a) {}
};
-const S3 c; // expected-note {{predetermined as shared}}
-const S3 ca[5]; // expected-note {{predetermined as shared}}
-extern const int f; // expected-note {{predetermined as shared}}
-class S4 { // expected-note {{'S4' declared here}}
+const S3 c; // expected-note {{global variable is predetermined as shared}}
+const S3 ca[5]; // expected-note {{global variable is predetermined as shared}}
+extern const int f; // expected-note {{global variable is predetermined as shared}}
+class S4 { // expected-note {{'S4' declared here}}
int a;
S4();
S4(const S4 &s4);
+
public:
- S4(int v):a(v) { }
+ S4(int v) : a(v) {}
};
class S5 { // expected-note {{'S5' declared here}}
int a;
- S5():a(0) {}
+ S5() : a(0) {}
+
public:
- S5(const S5 &s5):a(s5.a) { }
- S5(int v):a(v) { }
+ S5(const S5 &s5) : a(s5.a) {}
+ S5(int v) : a(v) {}
};
S3 h;
#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
-template<class I, class C> int foomain(I argc, C **argv) {
+template <class I, class C>
+int foomain(I argc, C **argv) {
I e(4);
I g(5);
int i;
- int &j = i; // expected-note {{'j' defined here}}
- #pragma omp simd lastprivate // expected-error {{expected '(' after 'lastprivate'}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd lastprivate ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd lastprivate () // expected-error {{expected expression}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd lastprivate (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd lastprivate (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd lastprivate (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd lastprivate (argc)
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd lastprivate (S1) // expected-error {{'S1' does not refer to a value}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd lastprivate (a, b) // expected-error {{lastprivate variable with incomplete type 'S1'}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd lastprivate (argv[1]) // expected-error {{expected variable name}}
- for (int k = 0; k < argc; ++k) ++k;
- #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}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd firstprivate(i) // expected-error {{unexpected OpenMP clause 'firstprivate' in directive '#pragma omp simd'}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp parallel
+ int &j = i; // expected-note {{'j' defined here}}
+#pragma omp simd lastprivate // expected-error {{expected '(' after 'lastprivate'}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd lastprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd lastprivate() // expected-error {{expected expression}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd lastprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd lastprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd lastprivate(argc)
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd lastprivate(a, b) // expected-error {{lastprivate variable with incomplete type 'S1'}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd lastprivate(argv[1]) // expected-error {{expected variable name}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#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}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd firstprivate(i) // expected-error {{unexpected OpenMP clause 'firstprivate' in directive '#pragma omp simd'}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp parallel
{
int v = 0;
int i;
- #pragma omp simd lastprivate(i)
- for (int k = 0; k < argc; ++k) { i = k; v += i; }
+#pragma omp simd lastprivate(i)
+ for (int k = 0; k < argc; ++k) {
+ i = k;
+ v += i;
+ }
}
- #pragma omp parallel shared(i)
- #pragma omp parallel private(i)
- #pragma omp simd lastprivate (j) // expected-error {{arguments of OpenMP clause 'lastprivate' cannot be of reference type}}
- for (int k = 0; k < argc; ++k) ++k;
- #pragma omp simd lastprivate(i)
- for (int k = 0; k < argc; ++k) ++k;
+#pragma omp parallel shared(i)
+#pragma omp parallel private(i)
+#pragma omp simd lastprivate(j) // expected-error {{arguments of OpenMP clause 'lastprivate' cannot be of reference type}}
+ for (int k = 0; k < argc; ++k)
+ ++k;
+#pragma omp simd lastprivate(i)
+ for (int k = 0; k < argc; ++k)
+ ++k;
return 0;
}
int main(int argc, char **argv) {
- const int d = 5; // expected-note {{predetermined as shared}}
- const int da[5] = { 0 }; // expected-note {{predetermined as shared}}
- S4 e(4); // expected-note {{'e' defined here}}
- S5 g(5); // expected-note {{'g' defined here}}
- S3 m; // expected-note {{'m' defined here}}
+ 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}}
+ S4 e(4); // expected-note {{'e' defined here}}
+ S5 g(5); // expected-note {{'g' defined here}}
+ S3 m; // expected-note {{'m' defined here}}
int i;
- int &j = i; // expected-note {{'j' defined here}}
- #pragma omp simd lastprivate // expected-error {{expected '(' after 'lastprivate'}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate () // expected-error {{expected expression}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate (argc)
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate (S1) // expected-error {{'S1' does not refer to a value}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate (a, b, c, d, f) // expected-error {{lastprivate variable with incomplete type 'S1'}} expected-error 3 {{shared variable cannot be lastprivate}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate (argv[1]) // expected-error {{expected variable name}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate (2*2) // expected-error {{expected variable name}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate(ba)
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate(ca) // expected-error {{shared variable cannot be lastprivate}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate(da) // expected-error {{shared variable cannot be lastprivate}}
- for (i = 0; i < argc; ++i) foo();
+ int &j = i; // expected-note {{'j' defined here}}
+#pragma omp simd lastprivate // expected-error {{expected '(' after 'lastprivate'}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate() // expected-error {{expected expression}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(argc)
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(a, b, c, d, f) // expected-error {{lastprivate variable with incomplete type 'S1'}} expected-error 3 {{shared variable cannot be lastprivate}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(argv[1]) // expected-error {{expected variable name}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(2 * 2) // expected-error {{expected variable name}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(ba)
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(ca) // expected-error {{shared variable cannot be lastprivate}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(da) // expected-error {{shared variable cannot be lastprivate}}
+ for (i = 0; i < argc; ++i)
+ foo();
int xa;
- #pragma omp simd lastprivate(xa) // OK
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate(S2::S2s) // expected-error {{shared variable cannot be lastprivate}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate(S2::S2sc) // expected-error {{shared variable cannot be lastprivate}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd firstprivate (g) // expected-error {{unexpected OpenMP clause 'firstprivate' in directive '#pragma omp simd'}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate(e, g) // expected-error 2 {{lastprivate variable must have an accessible, unambiguous default constructor}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate(m) // expected-error {{lastprivate variable must have an accessible, unambiguous copy assignment operator}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd private(xa), lastprivate(xa) // expected-error {{private variable cannot be lastprivate}} expected-note {{defined as private}}
- for (i = 0; i < argc; ++i) foo();
- #pragma omp simd lastprivate(i)
- for (i = 0; i < argc; ++i) foo();
- #pragma omp parallel private(xa)
- #pragma omp simd lastprivate(xa) // OK: may be lastprivate
- for (i = 0; i < argc; ++i) foo();
- #pragma omp parallel
- #pragma omp simd lastprivate(j) // expected-error {{arguments of OpenMP clause 'lastprivate' cannot be of reference type}}
- for (i = 0; i < argc; ++i) foo();
+#pragma omp simd lastprivate(xa) // OK
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(S2::S2s) // expected-error {{shared variable cannot be lastprivate}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(S2::S2sc) // expected-error {{shared variable cannot be lastprivate}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd firstprivate(g) // expected-error {{unexpected OpenMP clause 'firstprivate' in directive '#pragma omp simd'}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(e, g) // expected-error 2 {{lastprivate variable must have an accessible, unambiguous default constructor}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(m) // expected-error {{lastprivate variable must have an accessible, unambiguous copy assignment operator}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd private(xa), lastprivate(xa) // expected-error {{private variable cannot be lastprivate}} expected-note {{defined as private}}
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp simd lastprivate(i)
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp parallel private(xa)
+#pragma omp simd lastprivate(xa) // OK: may be lastprivate
+ for (i = 0; i < argc; ++i)
+ foo();
+#pragma omp parallel
+#pragma omp simd lastprivate(j) // expected-error {{arguments of OpenMP clause 'lastprivate' cannot be of reference type}}
+ for (i = 0; i < argc; ++i)
+ foo();
return 0;
}