From: David Sheinkman Date: Thu, 6 Oct 2016 15:47:36 +0000 (+0000) Subject: [OpenMP] Check if the template specialization is mappable instead of specialized... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ba7b1350117d23eb86be5f2532bd5a5efd89e724;p=clang [OpenMP] Check if the template specialization is mappable instead of specialized template Differential Revision: https://reviews.llvm.org/D25252 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283460 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaOpenMP.cpp b/lib/Sema/SemaOpenMP.cpp index 7dcd81f69d..237331da4a 100644 --- a/lib/Sema/SemaOpenMP.cpp +++ b/lib/Sema/SemaOpenMP.cpp @@ -10523,9 +10523,6 @@ static bool IsCXXRecordForMappable(Sema &SemaRef, SourceLocation Loc, if (!RD || RD->isInvalidDecl()) return true; - if (auto *CTSD = dyn_cast(RD)) - if (auto *CTD = CTSD->getSpecializedTemplate()) - RD = CTD->getTemplatedDecl(); auto QTy = SemaRef.Context.getRecordType(RD); if (RD->isDynamicClass()) { SemaRef.Diag(Loc, diag::err_omp_not_mappable_type) << QTy; diff --git a/test/OpenMP/target_map_messages.cpp b/test/OpenMP/target_map_messages.cpp index a3b2168fed..93f0216dd2 100644 --- a/test/OpenMP/target_map_messages.cpp +++ b/test/OpenMP/target_map_messages.cpp @@ -347,6 +347,15 @@ public: S5(int v):a(v) { } }; +template +struct S6; + +template<> +struct S6 // expected-note {{mappable type cannot be polymorphic}} +{ + virtual void foo(); +}; + S3 h; #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}} @@ -451,6 +460,7 @@ int main(int argc, char **argv) { int i; int &j = i; int *k = &j; + S6 m; int x; int y; int to, tofrom, always; @@ -513,6 +523,8 @@ int main(int argc, char **argv) { {} #pragma omp target firstprivate(j) map(j) // expected-error {{firstprivate variable cannot be in a map clause in '#pragma omp target' directive}} expected-note {{defined as firstprivate}} {} +#pragma omp target map(m) // expected-error {{type 'S6' is not mappable to target}} + {} return tmain(argc)+tmain(argc); // expected-note {{in instantiation of function template specialization 'tmain' requested here}} expected-note {{in instantiation of function template specialization 'tmain' requested here}} } #endif