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 | a995a47e38fae9fa60164c6692d8f5c4922fc175 (patch) | |
tree | bb51cf8b6426bc18742b7d5506d5fe2bb9f20c23 /clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | 152c9919e9d2c9d261b598405f2ef30e51b17b43 (diff) | |
download | bcm5719-llvm-a995a47e38fae9fa60164c6692d8f5c4922fc175.tar.gz bcm5719-llvm-a995a47e38fae9fa60164c6692d8f5c4922fc175.zip |
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
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index ba1bc9fd2a9..8afe7aca975 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/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) |