diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2012-04-04 02:38:36 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2012-04-04 02:38:36 +0000 |
commit | 95e3872918557b55b62121a7df5f1ee76d45881a (patch) | |
tree | 3173684c31029daaa1fea137feb12ac2a87c7863 /lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | beeb460aa571d23318fc0f6b8abcd868def791fa (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153992 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index ba1bc9fd2a..8afe7aca97 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -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) |