]> granicus.if.org Git - clang/commitdiff
For class template implicit instantiation, also update its location to point
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sat, 11 Feb 2012 01:59:57 +0000 (01:59 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sat, 11 Feb 2012 01:59:57 +0000 (01:59 +0000)
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>"
}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150290 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaTemplateInstantiate.cpp

index 8abb6e149a5fa91ce79e2320c27c1ebc4ccbb755..43aad0981788f6886d381c0f7d81cfb346b9d8d2 100644 (file)
@@ -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());
   }