diff options
author | David Sheinkman <davidsheinkman@outlook.com> | 2016-10-06 15:47:36 +0000 |
---|---|---|
committer | David Sheinkman <davidsheinkman@outlook.com> | 2016-10-06 15:47:36 +0000 |
commit | d03c85c02ec444cddb0d5d098e9164dbe59e5bde (patch) | |
tree | a6b0a9d43fd348d8c8abce77dd2d7d995f54ac49 /clang | |
parent | 36919a4f7c3e8d38c2db427b6957d6402a3f8322 (diff) | |
download | bcm5719-llvm-d03c85c02ec444cddb0d5d098e9164dbe59e5bde.tar.gz bcm5719-llvm-d03c85c02ec444cddb0d5d098e9164dbe59e5bde.zip |
[OpenMP] Check if the template specialization is mappable instead of specialized template Differential Revision: https://reviews.llvm.org/D25252
llvm-svn: 283460
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 3 | ||||
-rw-r--r-- | clang/test/OpenMP/target_map_messages.cpp | 12 |
2 files changed, 12 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 7dcd81f69d8..237331da4a3 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/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<ClassTemplateSpecializationDecl>(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/clang/test/OpenMP/target_map_messages.cpp b/clang/test/OpenMP/target_map_messages.cpp index a3b2168fedb..93f0216dd23 100644 --- a/clang/test/OpenMP/target_map_messages.cpp +++ b/clang/test/OpenMP/target_map_messages.cpp @@ -347,6 +347,15 @@ public: S5(int v):a(v) { } }; +template <class T> +struct S6; + +template<> +struct S6<int> // 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<int> 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<int>' is not mappable to target}} + {} return tmain<int, 3>(argc)+tmain<from, 4>(argc); // expected-note {{in instantiation of function template specialization 'tmain<int, 3>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<int, 4>' requested here}} } #endif |