[cfe-commits] r150290 - /cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Fri Feb 10 17:59:57 PST 2012


Author: akirtzidis
Date: Fri Feb 10 19:59:57 2012
New Revision: 150290

URL: http://llvm.org/viewvc/llvm-project?rev=150290&view=rev
Log:
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 <typename T1, typename T2>
struct S {
};

template <typename T>
struct S<T, int> {
};

void f() {
  S<int, int> s; // location of declaration "S<int, int>" was of "S<T1, T2>" not "S<T, int>"
}

Modified:
    cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=150290&r1=150289&r2=150290&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Fri Feb 10 19:59:57 2012
@@ -1863,6 +1863,7 @@
     ActOnFinishDelayedMemberInitializers(Instantiation);
 
   if (TSK == TSK_ImplicitInstantiation) {
+    Instantiation->setLocation(Pattern->getLocation());
     Instantiation->setLocStart(Pattern->getInnerLocStart());
     Instantiation->setRBraceLoc(Pattern->getRBraceLoc());
   }





More information about the cfe-commits mailing list