diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -5557,9 +5557,6 @@ if (S.getLangOpts().OpenMP < 50) return; SmallVector ImplicitMaps; - DeclarationNameInfo DefaultMapperId; - DefaultMapperId.setName(S.Context.DeclarationNames.getIdentifier( - &S.Context.Idents.get("default"))); for (int Cnt = 0, EndCnt = Clauses.size(); Cnt < EndCnt; ++Cnt) { auto *C = dyn_cast(Clauses[Cnt]); if (!C) @@ -5615,6 +5612,10 @@ if (It == Visited.end()) { // Try to find the associated user-defined mapper. CXXScopeSpec MapperIdScopeSpec; + DeclarationNameInfo DefaultMapperId; + DefaultMapperId.setName(S.Context.DeclarationNames.getIdentifier( + &S.Context.Idents.get("default"))); + DefaultMapperId.setLoc(E->getExprLoc()); ExprResult ER = buildUserDefinedMapperRef( S, Stack->getCurScope(), MapperIdScopeSpec, DefaultMapperId, BaseType, /*UnresolvedMapper=*/nullptr);