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.

llvm-svn: 153992
This commit is contained in:
Nick Lewycky 2012-04-04 02:38:36 +00:00
parent 152c9919e9
commit a995a47e38
1 changed files with 6 additions and 1 deletions

View File

@ -2661,8 +2661,13 @@ void Sema::InstantiateStaticDataMemberDefinition(
Consumer.HandleCXXStaticMemberVarInstantiation(Var); Consumer.HandleCXXStaticMemberVarInstantiation(Var);
// If we already have a definition, we're done. // 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; return;
}
InstantiatingTemplate Inst(*this, PointOfInstantiation, Var); InstantiatingTemplate Inst(*this, PointOfInstantiation, Var);
if (Inst) if (Inst)