]> granicus.if.org Git - clang/commitdiff
If something already instantiated is reinstantiated as an explicit definition,
authorNick Lewycky <nicholas@mxc.ca>
Wed, 4 Apr 2012 02:38:36 +0000 (02:38 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Wed, 4 Apr 2012 02:38:36 +0000 (02:38 +0000)
keep the latter.

No test. This was noticed when poking around something else with GDB. I'm not
able to figure out a testcase that would break due to this bug. Sorry.

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

lib/Sema/SemaTemplateInstantiateDecl.cpp

index ba1bc9fd2a9911fcc6ca08758668f413eb78366f..8afe7aca9750f3b1d059184e82abfe416b1cff7e 100644 (file)
@@ -2661,8 +2661,13 @@ void Sema::InstantiateStaticDataMemberDefinition(
   Consumer.HandleCXXStaticMemberVarInstantiation(Var);
 
   // If we already have a definition, we're done.
-  if (Var->getDefinition())
+  if (VarDecl *Def = Var->getDefinition()) {
+    // We may be explicitly instantiating something we've already implicitly
+    // instantiated.
+    Def->setTemplateSpecializationKind(Var->getTemplateSpecializationKind(),
+                                       PointOfInstantiation);
     return;
+  }
 
   InstantiatingTemplate Inst(*this, PointOfInstantiation, Var);
   if (Inst)