[cfe-commits] r153992 - /cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
Nick Lewycky
nicholas at mxc.ca
Tue Apr 3 19:38:36 PDT 2012
Author: nicholas
Date: Tue Apr 3 21:38:36 2012
New Revision: 153992
URL: http://llvm.org/viewvc/llvm-project?rev=153992&view=rev
Log:
If something already instantiated is reinstantiated as an explicit definition,
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.
Modified:
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=153992&r1=153991&r2=153992&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Tue Apr 3 21:38:36 2012
@@ -2661,8 +2661,13 @@
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)
More information about the cfe-commits
mailing list