[cfe-commits] [PATCH (need approval) 1/2] Set TemplateKeywordLoc correctly for template specialisations

Peter Collingbourne peter at pcc.me.uk
Mon Jul 5 11:42:34 PDT 2010


Currently TemplateKeywordLoc for template specialisations is set to
KWLoc by ActOnClassTemplateSpecialization.  This is wrong because
KWLoc is in fact the location of the tag keyword.  Instead, obtain
the location of the template keyword via TemplateParams.
---
 lib/Sema/SemaTemplate.cpp |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index 336a7bf..af1cb50 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -3959,7 +3959,8 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
                                                 TemplateArgs, CanonType);
   if (TUK != TUK_Friend) {
     Specialization->setTypeAsWritten(WrittenTy);
-    Specialization->setTemplateKeywordLoc(KWLoc);
+    if (TemplateParams)
+      Specialization->setTemplateKeywordLoc(TemplateParams->getTemplateLoc());
   }
   TemplateArgsIn.release();
 
-- 
1.6.5




More information about the cfe-commits mailing list