]> granicus.if.org Git - clang/commitdiff
[OpenMP] Check if the template specialization is mappable instead of specialized...
authorDavid Sheinkman <davidsheinkman@outlook.com>
Thu, 6 Oct 2016 15:47:36 +0000 (15:47 +0000)
committerDavid Sheinkman <davidsheinkman@outlook.com>
Thu, 6 Oct 2016 15:47:36 +0000 (15:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283460 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaOpenMP.cpp
test/OpenMP/target_map_messages.cpp

index 7dcd81f69d8ca6e642c45cfeca50488e0cde3279..237331da4a394a3aa14eb0005e287dc9cbd17521 100644 (file)
@@ -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;
index a3b2168fedbe9cc21ba43e8999d40b9e686f4d32..93f0216dd233175b67301b19cb644a32321835cb 100644 (file)
@@ -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