From: Hans Wennborg Date: Tue, 16 Feb 2016 19:47:16 +0000 (+0000) Subject: Merging r260370: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=63c572b11d39c76ecf9e0533d0b9263c86b6e190;p=clang Merging r260370: ------------------------------------------------------------------------ r260370 | abataev | 2016-02-10 02:50:12 -0800 (Wed, 10 Feb 2016) | 1 line Fix PR26543: add a check for definition in CXXRecordDecl. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_38@261002 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaOpenMP.cpp b/lib/Sema/SemaOpenMP.cpp index f66e2181b2..866461782f 100644 --- a/lib/Sema/SemaOpenMP.cpp +++ b/lib/Sema/SemaOpenMP.cpp @@ -634,7 +634,8 @@ DSAStackTy::DSAVarData DSAStackTy::getTopDSA(VarDecl *D, bool FromParent) { if (auto *CTD = CTSD->getSpecializedTemplate()) RD = CTD->getTemplatedDecl(); if (IsConstant && - !(SemaRef.getLangOpts().CPlusPlus && RD && RD->hasMutableFields())) { + !(SemaRef.getLangOpts().CPlusPlus && RD && RD->hasDefinition() && + 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), diff --git a/test/OpenMP/parallel_messages.cpp b/test/OpenMP/parallel_messages.cpp index 8aee8414f0..4db55a0195 100644 --- a/test/OpenMP/parallel_messages.cpp +++ b/test/OpenMP/parallel_messages.cpp @@ -5,7 +5,12 @@ void foo() { #pragma omp parallel // expected-error {{unexpected OpenMP directive '#pragma omp parallel'}} +struct S; +S& bar(); int main(int argc, char **argv) { + S &s = bar(); + #pragma omp parallel + (void)&s; #pragma omp parallel { // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}} foo(); #pragma omp parallel ( // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}}