Index: clang/lib/Sema/SemaOpenMP.cpp =================================================================== --- clang/lib/Sema/SemaOpenMP.cpp +++ clang/lib/Sema/SemaOpenMP.cpp @@ -17549,6 +17549,7 @@ auto &DeclNames = SemaRef.getASTContext().DeclarationNames; MapperId.setName(DeclNames.getIdentifier( &SemaRef.getASTContext().Idents.get("default"))); + MapperId.setLoc(StartLoc); } // Iterators to find the current unresolved mapper expression. Index: clang/test/OpenMP/template-specialization.cpp =================================================================== --- /dev/null +++ clang/test/OpenMP/template-specialization.cpp @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -verify -fopenmp -fsyntax-only %s + +// expected-no-diagnostics + +template +struct z { + static void aj() { + T f; +#pragma omp target map(f) + ; + } +}; + +template class ar {}; +template struct as {}; +template class z>>;