Index: lib/Sema/SemaOpenMP.cpp =================================================================== --- lib/Sema/SemaOpenMP.cpp +++ lib/Sema/SemaOpenMP.cpp @@ -10523,9 +10523,6 @@ 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; Index: test/OpenMP/target_map_messages.cpp =================================================================== --- test/OpenMP/target_map_messages.cpp +++ test/OpenMP/target_map_messages.cpp @@ -347,6 +347,15 @@ 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 i; int &j = i; int *k = &j; + S6 m; int x; int y; int to, tofrom, always; @@ -513,6 +523,8 @@ {} #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