From: Argyrios Kyrtzidis Date: Sat, 11 Feb 2012 01:59:57 +0000 (+0000) Subject: For class template implicit instantiation, also update its location to point X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=734bd6e25c349248634d1d0c5d7127c4868331b0;p=clang For class template implicit instantiation, also update its location to point to the pattern template that it came from, otherwise we had this situation: template struct S { }; template struct S { }; void f() { S s; // location of declaration "S" was of "S" not "S" } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150290 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 8abb6e149a..43aad09817 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -1863,6 +1863,7 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, ActOnFinishDelayedMemberInitializers(Instantiation); if (TSK == TSK_ImplicitInstantiation) { + Instantiation->setLocation(Pattern->getLocation()); Instantiation->setLocStart(Pattern->getInnerLocStart()); Instantiation->setRBraceLoc(Pattern->getRBraceLoc()); }